qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH v3 1/5] block: Keep subtree drained in drop_intermediate
Date: Mon, 22 Jul 2019 15:33:43 +0200	[thread overview]
Message-ID: <20190722133347.15122-2-mreitz@redhat.com> (raw)
In-Reply-To: <20190722133347.15122-1-mreitz@redhat.com>

bdrv_drop_intermediate() calls BdrvChildRole.update_filename().  That
may poll, thus changing the graph, which potentially breaks the
QLIST_FOREACH_SAFE() loop.

Just keep the whole subtree drained.  This is probably the right thing
to do anyway (dropping nodes while the subtree is not drained seems
wrong).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
---
 block.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block.c b/block.c
index 9c94f7f28a..818885d467 100644
--- a/block.c
+++ b/block.c
@@ -4499,6 +4499,7 @@ int bdrv_drop_intermediate(BlockDriverState *top, BlockDriverState *base,
     int ret = -EIO;
 
     bdrv_ref(top);
+    bdrv_subtree_drained_begin(top);
 
     if (!top->drv || !base->drv) {
         goto exit;
@@ -4570,6 +4571,7 @@ int bdrv_drop_intermediate(BlockDriverState *top, BlockDriverState *base,
 
     ret = 0;
 exit:
+    bdrv_subtree_drained_end(top);
     bdrv_unref(top);
     return ret;
 }
-- 
2.21.0



  reply	other threads:[~2019-07-22 13:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22 13:33 [Qemu-devel] [PATCH v3 0/5] block: Fixes for concurrent block jobs Max Reitz
2019-07-22 13:33 ` Max Reitz [this message]
2019-07-22 13:33 ` [Qemu-devel] [PATCH v3 2/5] block: Reduce (un)drains when replacing a child Max Reitz
2019-07-22 13:33 ` [Qemu-devel] [PATCH v3 3/5] tests: Test polling in bdrv_drop_intermediate() Max Reitz
2019-07-22 13:33 ` [Qemu-devel] [PATCH v3 4/5] tests: Test mid-drain bdrv_replace_child_noperm() Max Reitz
2019-07-22 13:33 ` [Qemu-devel] [PATCH v3 5/5] iotests: Add test for concurrent stream/commit Max Reitz
2019-08-07 14:05 ` [Qemu-devel] [PATCH v3 0/5] block: Fixes for concurrent block jobs 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=20190722133347.15122-2-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=kwolf@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).