qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 03/13] blockdev: Lock BDS during internal snapsho


From: Fam Zheng
Subject: [Qemu-devel] [PATCH v2 03/13] blockdev: Lock BDS during internal snapshot transaction
Date: Tue, 2 Jun 2015 11:21:52 +0800

Signed-off-by: Fam Zheng <address@hidden>
---
 blockdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/blockdev.c b/blockdev.c
index 5eaf77e..fdc5a17 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1356,6 +1356,7 @@ static void internal_snapshot_prepare(BlkTransactionState 
*common,
     }
 
     /* 4. succeed, mark a snapshot is created */
+    bdrv_lock(bs);
     state->bs = bs;
 }
 
@@ -1387,6 +1388,9 @@ static void internal_snapshot_clean(BlkTransactionState 
*common)
     InternalSnapshotState *state = DO_UPCAST(InternalSnapshotState,
                                              common, common);
 
+    if (state->bs) {
+        bdrv_unlock(state->bs);
+    }
     if (state->aio_context) {
         aio_context_release(state->aio_context);
     }
-- 
2.4.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]