qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 4/5] qcow2: lock on prealloc


From: Kevin Wolf
Subject: [Qemu-devel] [PATCH 4/5] qcow2: lock on prealloc
Date: Mon, 7 May 2012 19:55:53 +0200

From: Zhi Yong Wu <address@hidden>

preallocate() will be locked. This is required because
qcow2_alloc_cluster_link_l2() assumes that it runs under a lock that it
can drop while COW is being performed.

Signed-off-by: Zhi Yong Wu <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
 block/qcow2.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/block/qcow2.c b/block/qcow2.c
index 8c60a6f..ee4678f 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1192,7 +1192,10 @@ static int qcow2_create2(const char *filename, int64_t 
total_size,
 
     /* And if we're supposed to preallocate metadata, do that now */
     if (prealloc) {
+        BDRVQcowState *s = bs->opaque;
+        qemu_co_mutex_lock(&s->lock);
         ret = preallocate(bs);
+        qemu_co_mutex_unlock(&s->lock);
         if (ret < 0) {
             goto out;
         }
-- 
1.7.6.5




reply via email to

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