Skip to content
Snippets Groups Projects
  • Kevin Wolf's avatar
    e2dd2737
    block: Introduce bdrv_co_change_backing_file() · e2dd2737
    Kevin Wolf authored
    
    bdrv_change_backing_file() is called both inside and outside coroutine
    context. This makes it difficult for it to take the graph lock
    internally. It also means that driver implementations need to be able to
    run outside of coroutines, too. Switch it to the usual model with a
    coroutine based implementation and a co_wrapper instead. The new
    function is marked GRAPH_RDLOCK.
    
    As the co_wrapper now runs the function in the AioContext of the node
    (as it should always have done), this is not GLOBAL_STATE_CODE() any
    more.
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-ID: <20231027155333.420094-20-kwolf@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    e2dd2737
    History
    block: Introduce bdrv_co_change_backing_file()
    Kevin Wolf authored
    
    bdrv_change_backing_file() is called both inside and outside coroutine
    context. This makes it difficult for it to take the graph lock
    internally. It also means that driver implementations need to be able to
    run outside of coroutines, too. Switch it to the usual model with a
    coroutine based implementation and a co_wrapper instead. The new
    function is marked GRAPH_RDLOCK.
    
    As the co_wrapper now runs the function in the AioContext of the node
    (as it should always have done), this is not GLOBAL_STATE_CODE() any
    more.
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-ID: <20231027155333.420094-20-kwolf@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
block.c 254.35 KiB