Message ID | 1463559850-5244-2-git-send-email-famz@redhat.com |
---|---|
State | New |
Headers | show |
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? > 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 >
Am 18.05.2016 um 10:24 hat Fam Zheng geschrieben: > 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. > > 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) { How should this ever happen when we have target_bs = blk_bs(target_blk) two lines above? > + /* 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; > + } > + } Kevin
On Fri, 05/20 10:03, Kevin Wolf wrote: > Am 18.05.2016 um 10:24 hat Fam Zheng geschrieben: > > 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. > > > > 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) { > > How should this ever happen when we have target_bs = blk_bs(target_blk) > two lines above? I must have made a mistake with git or my editor, I meant to change it to bdrv_lookup_bs above. Fam > > > + /* 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; > > + } > > + } > > Kevin
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 > >
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) {
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. Signed-off-by: Fam Zheng <famz@redhat.com> --- blockdev.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)