Skip to contentSkip to conversation

blockdev: fix drive-backup transaction endless drained section

PATCH In review Vladimir Sementsov-Ogievskiy 3 participants 6 messages Jun 8, 2021 – Jul 8, 2021

lore
Share & tools
lore
#0 lore raw

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.

Fixes 2288ccfac96281c316db942d10e3f921c1373064
---
 blockdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
blockdev.c +1 -2
index f08192deda..094c085962 100644
@@ -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
#1 lore raw

[try add gitlab issue email to cc, will see how it work :)]

Quoted 8 lines · Vladimir Sementsov-Ogievskiy

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.

Fixes 2288ccfac96281c316db942d10e3f921c1373064
Reported-by Sergey Zhuravlev
Quoted 27 lines
---
  blockdev.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
blockdev.c +1 -2
index f08192deda..094c085962 100644
@@ -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
#2 lore raw
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() 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.

Fixes 2288ccfac96281c316db942d10e3f921c1373064
Reported-by Sergey Zhuravlev
Quoted 24 lines

---
  blockdev.c | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)
blockdev.c +1 -2
index f08192deda..094c085962 100644
@@ -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
Reviewed-by on v1 1/1
#3 lore raw
In reply to Vladimir Sementsov-Ogievskiy
Quoted 6 lines · Vladimir Sementsov-Ogievskiy

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.

Quoted 6 lines
Fixes 2288ccfac96281c316db942d10e3f921c1373064
---
 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
index f08192deda..094c085962 100644
@@ -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
#4 lore raw
In reply to Vladimir Sementsov-Ogievskiy

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() 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.

Fixes 2288ccfac96281c316db942d10e3f921c1373064
---
  blockdev.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
blockdev.c +1 -2
index f08192deda..094c085962 100644
@@ -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
#5 lore raw

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