All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Max Reitz <mreitz@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] blockdev-backup: Don't move target AioContext if it's attached
Date: Mon, 23 May 2016 09:09:47 +0800	[thread overview]
Message-ID: <20160523010947.GB8734@ad.usersys.redhat.com> (raw)
In-Reply-To: <20160519204252.GE24257@stefanha-x1.localdomain>

On Thu, 05/19 13:42, Stefan Hajnoczi wrote:
> On Wed, May 18, 2016 at 04:24:08PM +0800, Fam Zheng wrote:
> > If the BDS is attached, it will want to stay on the AioContext where its
> > BlockBackend is. Don't call bdrv_set_aio_context in this case.
> 
> What should the user do when they hit this error?

The user should backup to a dedicate target newly inserted with blockdev-add.
On this error, the user must be using a dataplane enabled virtual disk as
backup target, which is not supported.  The mirror job already refuses any
attached device, but for backup we want to support image fleecing and colo, in
which case the target is attached to NBD.

Fam

> 
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> >  blockdev.c | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/blockdev.c b/blockdev.c
> > index 1892b8e..eb15593 100644
> > --- a/blockdev.c
> > +++ b/blockdev.c
> > @@ -3376,8 +3376,18 @@ void do_blockdev_backup(const char *device, const char *target,
> >      }
> >      target_bs = blk_bs(target_blk);
> >  
> > +    if (bdrv_get_aio_context(target_bs) != aio_context) {
> > +        if (!target_bs->blk) {
> > +            /* The target BDS is not attached, we can safely move it to another
> > +             * AioContext. */
> > +            bdrv_set_aio_context(target_bs, aio_context);
> > +        } else {
> > +            error_setg(errp, "Target is attached to a different thread from "
> > +                             "source.");
> > +            goto out;
> > +        }
> > +    }
> >      bdrv_ref(target_bs);
> > -    bdrv_set_aio_context(target_bs, aio_context);
> >      backup_start(bs, target_bs, speed, sync, NULL, on_source_error,
> >                   on_target_error, block_job_cb, bs, txn, &local_err);
> >      if (local_err != NULL) {
> > -- 
> > 2.8.2
> > 

  reply	other threads:[~2016-05-23  1:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-18  8:24 [Qemu-devel] [PATCH 0/3] Drop virtio-{blk,scsi} op blockers Fam Zheng
2016-05-18  8:24 ` [Qemu-devel] [PATCH 1/3] blockdev-backup: Don't move target AioContext if it's attached Fam Zheng
2016-05-19 20:42   ` Stefan Hajnoczi
2016-05-23  1:09     ` Fam Zheng [this message]
2016-05-20  8:03   ` Kevin Wolf
2016-05-23  1:00     ` Fam Zheng
2016-05-18  8:24 ` [Qemu-devel] [PATCH 2/3] virtio-blk: Remove op blocker for dataplane Fam Zheng
2016-05-18  8:26   ` Michael S. Tsirkin
2016-05-18  8:24 ` [Qemu-devel] [PATCH 3/3] virtio-scsi: " Fam Zheng
2016-05-18  8:26   ` Michael S. Tsirkin
2016-05-18  8:27 ` [Qemu-devel] [PATCH 0/3] Drop virtio-{blk,scsi} op blockers Michael S. Tsirkin
2016-05-19 20:48 ` Stefan Hajnoczi
2016-05-19 20:55 ` Stefan Hajnoczi

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=20160523010947.GB8734@ad.usersys.redhat.com \
    --to=famz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.