]> git.karo-electronics.de Git - karo-tx-linux.git/commit
rbd: protect against duplicate client creation
authorAlex Elder <elder@inktank.com>
Wed, 29 May 2013 16:19:00 +0000 (11:19 -0500)
committerAlex Elder <elder@inktank.com>
Fri, 31 May 2013 22:02:01 +0000 (17:02 -0500)
commit601e01deceb4407153d19523cff5c28dbbdd95db
treef00905e4e3335b117b4b8a127a120581d062a9e7
parent93e85fbece064c31965aadc42fe58290f65c9218
rbd: protect against duplicate client creation

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/3094

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
drivers/block/rbd.c