Skip to content
Snippets Groups Projects
  • Kevin Wolf's avatar
    4db7ba3b
    block: Call .bdrv_co_create(_opts) unlocked · 4db7ba3b
    Kevin Wolf authored
    
    These are functions that modify the graph, so they must be able to take
    a writer lock. This is impossible if they already hold the reader lock.
    If they need a reader lock for some of their operations, they should
    take it internally.
    
    Many of them go through blk_*(), which will always take the lock itself.
    Direct calls of bdrv_*() need to take the reader lock. Note that while
    locking for bdrv_co_*() calls is checked by TSA, this is not the case
    for the mixed_coroutine_fns bdrv_*(). Holding the lock is still required
    when they are called from coroutine context like here!
    
    This effectively reverts 4ec8df01, but adds some internal locking
    instead.
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-Id: <20230510203601.418015-2-kwolf@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    4db7ba3b
    History
    block: Call .bdrv_co_create(_opts) unlocked
    Kevin Wolf authored
    
    These are functions that modify the graph, so they must be able to take
    a writer lock. This is impossible if they already hold the reader lock.
    If they need a reader lock for some of their operations, they should
    take it internally.
    
    Many of them go through blk_*(), which will always take the lock itself.
    Direct calls of bdrv_*() need to take the reader lock. Note that while
    locking for bdrv_co_*() calls is checked by TSA, this is not the case
    for the mixed_coroutine_fns bdrv_*(). Holding the lock is still required
    when they are called from coroutine context like here!
    
    This effectively reverts 4ec8df01, but adds some internal locking
    instead.
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-Id: <20230510203601.418015-2-kwolf@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>