From: Hanna Reitz <hreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, Hanna Reitz <hreitz@redhat.com>,
Kevin Wolf <kwolf@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PATCH 0/3] blcok: Start/end drain on correct AioContext
Date: Fri, 23 Sep 2022 14:52:24 +0200 [thread overview]
Message-ID: <20220923125227.300202-1-hreitz@redhat.com> (raw)
Hi,
bdrv_replace_child_noperm() drains the child via
bdrv_parent_drained_{begin,end}_single(). When it removes a child, the
bdrv_parent_drained_end_single() at its end will be called on an empty
child, making the BDRV_POLL_WHILE() in it poll the main AioContext
(because c->bs is NULL).
Thatâs wrong, though, because itâs supposed to operate on the parent.
bdrv_parent_drained_end_single_no_poll() will have scheduled any BHs in
the parentsâ AioContext, which may be anything, not necessarily the main
context. Therefore, we must poll the parentâs context.
Patch 3 does this for both bdrv_parent_drained_{begin,end}_single().
Patch 1 ensures that we can legally call
bdrv_child_get_parent_aio_context() from those functions (currently
marked as GLOBAL_STATE_CODE(), which I donât think it is), and patch 2
fixes blk_do_set_aio_context() to not cause an assertion failure if it
beginning a drain can end up in blk_get_aio_context() before blk->ctx
has been updated.
Hanna Reitz (3):
block: bdrv_child_get_parent_aio_context is not GS
block-backend: Update ctx immediately after root
block: Start/end drain on correct AioContext
block.c | 2 +-
block/block-backend.c | 4 +++-
block/io.c | 6 ++++--
3 files changed, 8 insertions(+), 4 deletions(-)
--
2.36.1
next reply other threads:[~2022-09-23 13:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-23 12:52 Hanna Reitz [this message]
2022-09-23 12:52 ` [PATCH 1/3] block: bdrv_child_get_parent_aio_context is not GS Hanna Reitz
2022-10-07 8:44 ` Kevin Wolf
2022-09-23 12:52 ` [PATCH 2/3] block-backend: Update ctx immediately after root Hanna Reitz
2022-10-07 8:48 ` Kevin Wolf
2022-09-23 12:52 ` [PATCH 3/3] block: Start/end drain on correct AioContext Hanna Reitz
2022-10-07 9:05 ` 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=20220923125227.300202-1-hreitz@redhat.com \
--to=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).