Skip to content
  • Kevin Wolf's avatar
    7d4ca9d2
    block: Mark bdrv_attach_child_common() GRAPH_WRLOCK · 7d4ca9d2
    Kevin Wolf authored
    
    
    Instead of taking the writer lock internally, require callers to already
    hold it when calling bdrv_attach_child_common(). These callers will
    typically already hold the graph lock once the locking work is
    completed, which means that they can't call functions that take it
    internally.
    
    Note that the transaction callbacks still take the lock internally, so
    tran_finalize() must be called without the lock held. This is because
    bdrv_append() also calls bdrv_replace_node_noperm(), which currently
    requires the transaction callbacks to be called unlocked. In the next
    step, both of them can be switched to locked tran_finalize() calls
    together.
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Message-ID: <20230911094620.45040-11-kwolf@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    7d4ca9d2
    block: Mark bdrv_attach_child_common() GRAPH_WRLOCK
    Kevin Wolf authored
    
    
    Instead of taking the writer lock internally, require callers to already
    hold it when calling bdrv_attach_child_common(). These callers will
    typically already hold the graph lock once the locking work is
    completed, which means that they can't call functions that take it
    internally.
    
    Note that the transaction callbacks still take the lock internally, so
    tran_finalize() must be called without the lock held. This is because
    bdrv_append() also calls bdrv_replace_node_noperm(), which currently
    requires the transaction callbacks to be called unlocked. In the next
    step, both of them can be switched to locked tran_finalize() calls
    together.
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Message-ID: <20230911094620.45040-11-kwolf@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading