Skip to content
  • Kevin Wolf's avatar
    30dd65f3
    block: Fix cross-AioContext blockdev-snapshot · 30dd65f3
    Kevin Wolf authored
    
    
    external_snapshot_prepare() tries to move the overlay to the AioContext
    of the backing file (the snapshotted node). However, it's possible that
    this doesn't work, but the backing file can instead be moved to the
    overlay's AioContext (e.g. opening the backing chain for a mirror
    target).
    
    bdrv_append() already indirectly uses bdrv_attach_node(), which takes
    care to move nodes to make sure they use the same AioContext and which
    tries both directions.
    
    So the problem has a simple fix: Just delete the unnecessary extra
    bdrv_try_set_aio_context() call in external_snapshot_prepare() and
    instead assert in bdrv_append() that both nodes were indeed moved to the
    same AioContext.
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-Id: <20200310113831.27293-6-kwolf@redhat.com>
    Tested-by: default avatarPeter Krempa <pkrempa@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    30dd65f3
    block: Fix cross-AioContext blockdev-snapshot
    Kevin Wolf authored
    
    
    external_snapshot_prepare() tries to move the overlay to the AioContext
    of the backing file (the snapshotted node). However, it's possible that
    this doesn't work, but the backing file can instead be moved to the
    overlay's AioContext (e.g. opening the backing chain for a mirror
    target).
    
    bdrv_append() already indirectly uses bdrv_attach_node(), which takes
    care to move nodes to make sure they use the same AioContext and which
    tries both directions.
    
    So the problem has a simple fix: Just delete the unnecessary extra
    bdrv_try_set_aio_context() call in external_snapshot_prepare() and
    instead assert in bdrv_append() that both nodes were indeed moved to the
    same AioContext.
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-Id: <20200310113831.27293-6-kwolf@redhat.com>
    Tested-by: default avatarPeter Krempa <pkrempa@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading