• Alex Elder's avatar
    rbd: don't hold ctl_mutex to get/put device · 1ba0f1e7
    Alex Elder authored
    When an rbd device is first getting mapped, its device registration
    is protected the control mutex.  There is no need to do that though,
    because the device has already been assigned an id that's guaranteed
    to be unique.
    
    An unmap of an rbd device won't proceed if the device has a non-zero
    open count or is already being unmapped.  So there's no need to hold
    the control mutex in that case either.
    
    Finally, an rbd device can't be opened if it is being removed, and
    it won't go away if there is a non-zero open count.  So here too
    there's no need to hold the control mutex while getting or putting a
    reference to an rbd device's Linux device structure.
    
    Drop the mutex calls in these cases.
    Signed-off-by: default avatarAlex Elder <elder@inktank.com>
    Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
    1ba0f1e7
rbd.c 135 KB