blockdev: fix drive-backup transaction endless drained section
PATCH 1/1 blockdev: fix drive-backup transaction endless drained section
drive_backup_prepare() does bdrv_drained_begin() in hope that bdrv_drained_end() will be called in drive_backup_clean(). Still we need to set state->bs for this to work. That's done too late: a lot of failure paths in drive_backup_prepare() miss setting state->bs. Fix that.
--- blockdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
blockdev.c +1 -2
@@ -1714,6 +1714,7 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp) aio_context =bdrv_get_aio_context (bs);aio_context_acquire (aio_context); + state->bs = bs;/* Paired with .clean() */ bdrv_drained_begin (bs);
@@ -1813,8 +1814,6 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp) } } - state->bs = bs; - state->job =do_backup_common (qapi_DriveBackup_base (backup), bs, target_bs, aio_context, common->block_job_txn, errp);
Signature · 1 line
2.29.2
[try add gitlab issue email to cc, will see how it work :)]
Quoted 8 lines · Vladimir Sementsov-Ogievskiy
drive_backup_prepare()doesbdrv_drained_begin()in hope thatbdrv_drained_end()will be called indrive_backup_clean(). Still we need to setstate->bsfor this to work. That's done too late: a lot of failure paths indrive_backup_prepare()miss settingstate->bs. Fix that.Fixes 2288ccfac96281c316db942d10e3f921c1373064
Quoted 27 lines
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- blockdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)blockdev.c +1
-2@@ -1714,6 +1714,7 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp) aio_context =bdrv_get_aio_context (bs);aio_context_acquire (aio_context); + state->bs = bs;/* Paired with .clean() */ bdrv_drained_begin (bs);@@ -1813,8 +1814,6 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp) } } - state->bs = bs; - state->job =do_backup_common (qapi_DriveBackup_base (backup), bs, target_bs, aio_context, common->block_job_txn, errp);
Signature · 2 lines
Best regards, Vladimir
Quoted 1 line · Vladimir Sementsov-Ogievskiy
[try add gitlab issue email to cc, will see how it work :)]
That was bad idea. The message becomes a new comment at issue page. Formatting is broken, looks bad. I've removed that comment
Quoted 39 lines
Quoted 8 lines · Vladimir Sementsov-Ogievskiy
drive_backup_prepare()doesbdrv_drained_begin()in hope thatbdrv_drained_end()will be called indrive_backup_clean(). Still we need to setstate->bsfor this to work. That's done too late: a lot of failure paths indrive_backup_prepare()miss settingstate->bs. Fix that.Fixes 2288ccfac96281c316db942d10e3f921c1373064Reported-by Sergey ZhuravlevQuoted 24 lines
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>---
blockdev.c| 3 +--1 file changed, 1 insertion(+), 2 deletions(-)blockdev.c +1
-2@@ -1714,6 +1714,7 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp) aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); + state->bs = bs; /* Paired with .clean() */ bdrv_drained_begin(bs);@@ -1813,8 +1814,6 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp) } } - state->bs = bs; - state->job = do_backup_common(qapi_DriveBackup_base(backup), bs, target_bs, aio_context, common->block_job_txn, errp);
Signature · 2 lines
Best regards, Vladimir
Quoted 6 lines · Vladimir Sementsov-Ogievskiy
drive_backup_prepare()doesbdrv_drained_begin()in hope thatbdrv_drained_end()will be called indrive_backup_clean(). Still we need to setstate->bsfor this to work. That's done too late: a lot of failure paths indrive_backup_prepare()miss settingstate->bs. Fix that.
Quoted 6 lines
Fixes 2288ccfac96281c316db942d10e3f921c1373064Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- blockdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
blockdev.c static void drive_backup_prepare(BlkActionState *common, Error **errp) · line 1719
Quoted 12 lines
blockdev.c +1
-0@@ -1714,6 +1714,7 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp) aio_context =bdrv_get_aio_context (bs);aio_context_acquire (aio_context); + state->bs = bs;/* Paired with .clean() */ bdrv_drained_begin (bs);
Commit 2288ccfac9 had these two lines in the opposite order, but that doesn't matter, the important part is that we do indeed need to set state->bs regardless of any later failure detections, to get .clean to do the matching drained_end.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Forgotten thing :(
Kevin, could you please queue it in your block branch? For me not to bother Peter with one-patch pull request.
Quoted 35 lines · Vladimir Sementsov-Ogievskiy
drive_backup_prepare()doesbdrv_drained_begin()in hope thatbdrv_drained_end()will be called indrive_backup_clean(). Still we need to setstate->bsfor this to work. That's done too late: a lot of failure paths indrive_backup_prepare()miss settingstate->bs. Fix that.Fixes 2288ccfac96281c316db942d10e3f921c1373064Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- blockdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)blockdev.c +1
-2@@ -1714,6 +1714,7 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp) aio_context =bdrv_get_aio_context (bs);aio_context_acquire (aio_context); + state->bs = bs;/* Paired with .clean() */ bdrv_drained_begin (bs);@@ -1813,8 +1814,6 @@ static void drive_backup_prepare(BlkActionState *common, Error **errp) } } - state->bs = bs; - state->job =do_backup_common (qapi_DriveBackup_base (backup), bs, target_bs, aio_context, common->block_job_txn, errp);
Signature · 2 lines
Best regards, Vladimir
Am 07.07.2021 um 15:35 hat Vladimir Sementsov-Ogievskiy geschrieben:
Quoted 4 lines
Forgotten thing :(
Kevin, could you please queue it in your block branch? For me not to bother Peter with one-patch pull request.
No problem, I've queued it now.
Kevin