Skip to content

Commit

Permalink
blockdev: fix drive-backup transaction endless drained section
Browse files Browse the repository at this point in the history
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: 2288ccf
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/399
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210608171852.250775-1-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
Vladimir Sementsov-Ogievskiy authored and kevmw committed Jul 9, 2021
1 parent 84affad commit 2842ff2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions blockdev.c
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2842ff2

Please sign in to comment.