• Alex Elder's avatar
    rbd: protect against duplicate client creation · 08f75463
    Alex Elder authored
    If more than one rbd image has the same ceph cluster configuration
    (same options, same set of monitors, same keys) they normally share
    a single rbd client.
    
    When an image is getting mapped, rbd looks to see if an existing
    client can be used, and creates a new one if not.
    
    The lookup and creation are not done under a common lock though, so
    mapping two images concurrently could lead to duplicate clients
    getting set up needlessly.  This isn't a major problem, but it's
    wasteful and different from what's intended.
    
    This patch fixes that by using the control mutex to protect
    both the lookup and (if needed) creation of the client.  It
    was previously used just when creating.
    
    This resolves:
        http://tracker.ceph.com/issues/3094Signed-off-by: default avatarAlex Elder <elder@inktank.com>
    Reviewed-by: default avatarJosh Durgin <josh.durgin@inktank.com>
    08f75463
rbd.c 136 KB