From: Eric Blake <eblake@redhat.com>
To: Sergio Lopez <slp@redhat.com>, qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH v2] nbd/server: attach client channel to the export's AioContext
Date: Fri, 20 Sep 2019 07:38:19 -0500 [thread overview]
Message-ID: <b186ebf4-bf9f-b653-938f-9219e3722c07@redhat.com> (raw)
In-Reply-To: <20190912110032.26395-1-slp@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 1798 bytes --]
On 9/12/19 6:00 AM, Sergio Lopez wrote:
> On creation, the export's AioContext is set to the same one as the
> BlockBackend, while the AioContext in the client QIOChannel is left
> untouched.
>
> As a result, when using data-plane, nbd_client_receive_next_request()
> schedules coroutines in the IOThread AioContext, while the client's
> QIOChannel is serviced from the main_loop, potentially triggering the
> assertion at qio_channel_restart_[read|write].
>
> To fix this, as soon we have the export corresponding to the client,
> we call qio_channel_attach_aio_context() to attach the QIOChannel
> context to the export's AioContext. This matches with the logic at
> blk_aio_attached().
>
> RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1748253
> Signed-off-by: Sergio Lopez <slp@redhat.com>
> ---
> Changelog
>
> v2:
> - Attach the channel once after negotiation completes, avoiding
> duplication. (thanks Kevin Wolf).
> ---
> nbd/server.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/nbd/server.c b/nbd/server.c
> index 28c3c8be85..31d624e146 100644
> --- a/nbd/server.c
> +++ b/nbd/server.c
> @@ -1297,6 +1297,11 @@ static coroutine_fn int nbd_negotiate(NBDClient *client, Error **errp)
> return ret;
> }
>
> + /* Attach the channel to the same AioContext as the export */
> + if (client->exp && client->exp->ctx) {
> + qio_channel_attach_aio_context(client->ioc, client->exp->ctx);
> + }
> +
Reviewed-by: Eric Blake <eblake@redhat.com>
Will queue through my NBD tree.
> assert(!client->optlen);
> trace_nbd_negotiate_success();
>
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-09-20 12:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-12 11:00 [Qemu-devel] [PATCH v2] nbd/server: attach client channel to the export's AioContext Sergio Lopez
2019-09-20 12:38 ` Eric Blake [this message]
2019-09-20 18:12 ` [Qemu-block] " John Snow
2019-09-20 18:49 ` John Snow
2019-09-20 19:11 ` Eric Blake
2019-09-20 22:03 ` Eric Blake
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=b186ebf4-bf9f-b653-938f-9219e3722c07@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=slp@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).