From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com
Subject: [Qemu-devel] [PATCH v2 8/9] qcow2: Fix BDRV_O_INACTIVE handling in qcow2_invalidate_cache()
Date: Wed, 13 Jan 2016 17:37:15 +0100 [thread overview]
Message-ID: <1452703036-17999-9-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1452703036-17999-1-git-send-email-kwolf@redhat.com>
What qcow2_invalidate_cache() should do is close the image with
BDRV_O_INACTIVE set and reopen it with the flag cleared. In fact, it
used to do exactly the opposite: qcow2_close() relied on bs->open_flags,
which is already updated to have cleared BDRV_O_INACTIVE at this point,
whereas qcow2_open() was called with s->flags, which has the flag still
set. Fix this.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
block/qcow2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 519e2ae..1b9c5fc 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1718,7 +1718,7 @@ static void qcow2_close(BlockDriverState *bs)
/* else pre-write overlap checks in cache_destroy may crash */
s->l1_table = NULL;
- if (!(bs->open_flags & BDRV_O_INACTIVE)) {
+ if (!(s->flags & BDRV_O_INACTIVE)) {
qcow2_inactivate(bs);
}
@@ -1769,6 +1769,7 @@ static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp)
memset(s, 0, sizeof(BDRVQcow2State));
options = qdict_clone_shallow(bs->options);
+ flags &= ~BDRV_O_INACTIVE;
ret = qcow2_open(bs, options, flags, &local_err);
QDECREF(options);
if (local_err) {
--
1.8.3.1
next prev parent reply other threads:[~2016-01-13 16:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-13 16:37 [Qemu-devel] [PATCH v2 0/9] block/qcow2: Migration handoff fixes and cleanups Kevin Wolf
2016-01-13 16:37 ` [Qemu-devel] [PATCH v2 1/9] qcow2: Write feature table only for v3 images Kevin Wolf
2016-01-13 16:37 ` [Qemu-devel] [PATCH v2 2/9] qcow2: Write full header on image creation Kevin Wolf
2016-01-13 16:37 ` [Qemu-devel] [PATCH v2 3/9] block: Assert no write requests under BDRV_O_INCOMING Kevin Wolf
2016-01-13 16:37 ` [Qemu-devel] [PATCH v2 4/9] block: Fix error path in bdrv_invalidate_cache() Kevin Wolf
2016-01-13 16:37 ` [Qemu-devel] [PATCH v2 5/9] block: Rename BDRV_O_INCOMING to BDRV_O_INACTIVE Kevin Wolf
2016-01-13 16:49 ` Eric Blake
2016-01-13 16:37 ` [Qemu-devel] [PATCH v2 6/9] block: Inactivate BDS when migration completes Kevin Wolf
2016-01-13 16:37 ` [Qemu-devel] [PATCH v2 7/9] qcow2: Implement .bdrv_inactivate Kevin Wolf
2016-01-13 16:37 ` Kevin Wolf [this message]
2016-01-13 16:37 ` [Qemu-devel] [PATCH v2 9/9] qcow2: Make image inaccessible after failed qcow2_invalidate_cache() Kevin Wolf
2016-01-19 16:55 ` [Qemu-devel] [PATCH v2 0/9] block/qcow2: Migration handoff fixes and cleanups Kevin Wolf
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=1452703036-17999-9-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--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).