qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Alberto Garcia <berto@igalia.com>
Cc: pkrempa@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org,
	mreitz@redhat.com
Subject: Re: [PATCH 2/2] block: bdrv_reopen() with backing file in different AioContext
Date: Fri, 6 Mar 2020 15:10:03 +0100	[thread overview]
Message-ID: <20200306141003.GD7240@linux.fritz.box> (raw)
In-Reply-To: <w51h7z27q68.fsf@maestria.local.igalia.com>

Am 05.03.2020 um 16:54 hat Alberto Garcia geschrieben:
> On Thu 27 Feb 2020 07:18:04 PM CET, Kevin Wolf wrote:
> >      /*
> > -     * TODO: before removing the x- prefix from x-blockdev-reopen we
> > -     * should move the new backing file into the right AioContext
> > -     * instead of returning an error.
> > +     * Check AioContext compatibility so that the bdrv_set_backing_hd() call in
> > +     * bdrv_reopen_commit() won't fail.
> >       */
> > -    if (new_backing_bs) {
> > -        if (bdrv_get_aio_context(new_backing_bs) != bdrv_get_aio_context(bs)) {
> > -            error_setg(errp, "Cannot use a new backing file "
> > -                       "with a different AioContext");
> > -            return -EINVAL;
> > -        }
> > +    if (!bdrv_reopen_can_attach(bs->backing, bs, new_backing_bs, errp)) {
> > +        return -EINVAL;
> >      }
> 
> What happens here now if 'new_backing_bs' is NULL ?
> 
> It seems that you would be calling bdrv_can_set_aio_context(NULL, ...),
> and it looks like that would crash.

Not sure why I thought that this check isn't needed any more...

It actually works as long as everything runs in the main loop context
(because bdrv_get_aio_context(NULL) return the main context, so there is
nothing to do), which is why the test cases didn't fail. But as soon as
you move things to a different AioContext, they will fail.

Maybe even worse, the argument order for bdrv_reopen_can_attach() is
wrong.

Thanks for catching this, I'll send a v2.

Kevin



  reply	other threads:[~2020-03-06 14:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 18:18 [PATCH 0/2] block: bdrv_reopen() with backing file in different AioContext Kevin Wolf
2020-02-27 18:18 ` [PATCH 1/2] iotests: Refactor blockdev-reopen test for iothreads Kevin Wolf
2020-02-27 18:18 ` [PATCH 2/2] block: bdrv_reopen() with backing file in different AioContext Kevin Wolf
2020-03-05 15:54   ` Alberto Garcia
2020-03-06 14:10     ` Kevin Wolf [this message]
2020-03-04  9:29 ` [PATCH 0/2] " Peter Krempa
2020-03-04  9:40   ` 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=20200306141003.GD7240@linux.fritz.box \
    --to=kwolf@redhat.com \
    --cc=berto@igalia.com \
    --cc=mreitz@redhat.com \
    --cc=pkrempa@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).