qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org
Subject: [PULL 02/10] block: bdrv_set_backing_hd(): use drained section
Date: Tue,  1 Feb 2022 16:21:00 +0100	[thread overview]
Message-ID: <20220201152108.171898-3-kwolf@redhat.com> (raw)
In-Reply-To: <20220201152108.171898-1-kwolf@redhat.com>

From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

Graph modifications should be done in drained section. stream_prepare()
handler of block stream job call bdrv_set_backing_hd() without using
drained section and it's theoretically possible that some IO request
will interleave with graph modification and will use outdated pointers
to removed block nodes.

Some other callers use bdrv_set_backing_hd() not caring about drained
sections too. So it seems good to make a drained section exactly in
bdrv_set_backing_hd().

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20220124173741.2984056-1-vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/block.c b/block.c
index 7b3ce415d8..b54d59d1fa 100644
--- a/block.c
+++ b/block.c
@@ -3341,6 +3341,8 @@ int bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd,
     int ret;
     Transaction *tran = tran_new();
 
+    bdrv_drained_begin(bs);
+
     ret = bdrv_set_backing_noperm(bs, backing_hd, tran, errp);
     if (ret < 0) {
         goto out;
@@ -3350,6 +3352,8 @@ int bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd,
 out:
     tran_finalize(tran, ret);
 
+    bdrv_drained_end(bs);
+
     return ret;
 }
 
-- 
2.31.1



  parent reply	other threads:[~2022-02-01 16:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01 15:20 [PULL 00/10] Block layer patches Kevin Wolf
2022-02-01 15:20 ` [PULL 01/10] qemu-storage-daemon: Fix typo in vhost-user-blk help Kevin Wolf
2022-02-01 15:21 ` Kevin Wolf [this message]
2022-02-01 15:21 ` [PULL 03/10] block/export: Fix vhost-user-blk shutdown with requests in flight Kevin Wolf
2022-02-01 15:21 ` [PULL 04/10] block/export/fuse: Rearrange if-else-if ladder in fuse_fallocate() Kevin Wolf
2022-02-01 15:21 ` [PULL 05/10] block/export/fuse: Fix build failure on FreeBSD Kevin Wolf
2022-02-01 15:21 ` [PULL 06/10] block.h: remove outdated comment Kevin Wolf
2022-02-01 15:21 ` [PULL 07/10] qsd: Document fuse's allow-other option Kevin Wolf
2022-02-01 15:21 ` [PULL 08/10] qemu-img: Unify [-b [-F]] documentation Kevin Wolf
2022-02-01 15:21 ` [PULL 09/10] block/rbd: fix handling of holes in .bdrv_co_block_status Kevin Wolf
2022-02-01 15:21 ` [PULL 10/10] block/rbd: workaround for ceph issue #53784 Kevin Wolf
2022-02-02  9:05 ` [PULL 00/10] Block layer patches Peter Maydell

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=20220201152108.171898-3-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).