do_drive_backup() acquires the AioContext lock of the corresponding BlockDriverState. This is not a problem when it's called from qmp_drive_backup(), but drive_backup_prepare() also acquires the lock before calling it.
Additionally, Max Reitz pointed out that bdrv_try_set_aio_context() is called at do_backup_common() with the new context held, and the old context not held, while it expects it to be the other way around. This is also the case for other uses of that function on blockdev.c. This patch series fixes all occurrences of bdrv_try_set_aio_context() to honor the context requirements. It also changes drive_backup_prepare() to release the context before calling do_drive_backup(). --- Changelog v2: - Honor bdrv_try_set_aio_context() context acquisition requirements (thanks Max Reitz). - Release the context at drive_backup_prepare() instead of avoiding re-acquiring it at do_drive_baclup(). (thanks Max Reitz) - Convert a single patch into a two-patch series. --- Sergio Lopez (2): blockdev: release the AioContext at drive_backup_prepare blockdev: honor bdrv_try_set_aio_context() context requirements blockdev.c | 127 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 76 insertions(+), 51 deletions(-) -- 2.21.0