On Fri 16 Nov 2018 05:45:24 PM CET, Max Reitz wrote: > bdrv_reopen_multiple() does not invoke bdrv_reopen_abort() for the > element of the reopen queue for which bdrv_reopen_prepare() failed, > because it assumes that the prepare function will have rolled back all > changes already. > > However, bdrv_reopen_prepare() does not do this in every case: It may > notice an error after BlockDriver.bdrv_reopen_prepare() succeeded, and > it will not invoke BlockDriver.bdrv_reopen_abort() then; and neither > will bdrv_reopen_multiple(), as explained above. > > This is wrong because we must always call .bdrv_reopen_commit() or > .bdrv_reopen_abort() after .bdrv_reopen_prepare() has succeeded. > Otherwise, the block driver has no chance to undo what it has done in > its implementation of .bdrv_reopen_prepare(). > > To fix this, bdrv_reopen_prepare() has to call .bdrv_reopen_abort() if > it wants to return an error after .bdrv_reopen_prepare() has succeeded. > > Signed-off-by: Max Reitz <mre...@redhat.com>
Reviewed-by: Alberto Garcia <be...@igalia.com> Berto