From: Kevin Wolf <kwolf@redhat.com>
To: anthony@codemonkey.ws
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/5] qcow2: lock on prealloc
Date: Mon, 7 May 2012 19:55:53 +0200 [thread overview]
Message-ID: <1336413354-5244-5-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1336413354-5244-1-git-send-email-kwolf@redhat.com>
From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
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 <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
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
next prev parent reply other threads:[~2012-05-07 17:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-07 17:55 [Qemu-devel] [PULL 0/5] Block patches for 1.1 Kevin Wolf
2012-05-07 17:55 ` [Qemu-devel] [PATCH 1/5] sheepdog: switch to writethrough mode if cluster doesn't support flush Kevin Wolf
2012-05-07 17:55 ` [Qemu-devel] [PATCH 2/5] qcow2: Limit COW to where it's needed Kevin Wolf
2012-05-07 17:55 ` [Qemu-devel] [PATCH 3/5] block: make bdrv_create adopt coroutine Kevin Wolf
2012-05-07 17:55 ` Kevin Wolf [this message]
2012-05-07 17:55 ` [Qemu-devel] [PATCH 5/5] fdc: simplify media change handling Kevin Wolf
2012-05-08 16:11 ` [Qemu-devel] [PULL 0/5] Block patches for 1.1 Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1336413354-5244-5-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).