• M
    block: Always abort reopen after prepare succeeded · 9ad08c44
    Max Reitz 提交于
    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: NMax Reitz <mreitz@redhat.com>
    Reviewed-by: NAlberto Garcia <berto@igalia.com>
    Signed-off-by: NKevin Wolf <kwolf@redhat.com>
    9ad08c44
block.c 162.1 KB