aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlex Elder <elder@dreamhost.com>2012-01-29 14:57:44 -0500
committerAlex Elder <elder@dreamhost.com>2012-03-22 11:47:47 -0400
commitd97081b0c7bdb55371994cc6690217bf393eb63e (patch)
treea520fd2d821202175749fc9a0dd9b1b4a1fa2ac8 /drivers
parente6994d3ddedf1a9f35cb43655bb4b5810e71199a (diff)
rbd: move ctl_mutex lock inside rbd_get_client()
Since rbd_get_client() is only called in one place, move the acquisition of the mutex around that call inside that function. Furthermore, within rbd_get_client(), it appears the mutex only needs to be held while calling rbd_client_create(). (Moving the lock inside that function will wait for the next patch.) Signed-off-by: Alex Elder <elder@dreamhost.com> Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/rbd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index bccd350a032..7f60ff28ac2 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -396,7 +396,10 @@ static int rbd_get_client(struct rbd_device *rbd_dev, const char *mon_addr,
396 } 396 }
397 spin_unlock(&node_lock); 397 spin_unlock(&node_lock);
398 398
399 mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
399 rbdc = rbd_client_create(opt, rbd_opts); 400 rbdc = rbd_client_create(opt, rbd_opts);
401 mutex_unlock(&ctl_mutex);
402
400 if (IS_ERR(rbdc)) { 403 if (IS_ERR(rbdc)) {
401 ret = PTR_ERR(rbdc); 404 ret = PTR_ERR(rbdc);
402 goto done_err; 405 goto done_err;
@@ -2276,10 +2279,7 @@ static ssize_t rbd_add(struct bus_type *bus,
2276 /* initialize rest of new object */ 2279 /* initialize rest of new object */
2277 snprintf(rbd_dev->name, DEV_NAME_LEN, DRV_NAME "%d", rbd_dev->id); 2280 snprintf(rbd_dev->name, DEV_NAME_LEN, DRV_NAME "%d", rbd_dev->id);
2278 2281
2279 mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
2280 rc = rbd_get_client(rbd_dev, mon_dev_name, options); 2282 rc = rbd_get_client(rbd_dev, mon_dev_name, options);
2281 mutex_unlock(&ctl_mutex);
2282
2283 if (rc < 0) 2283 if (rc < 0)
2284 goto err_out_slot; 2284 goto err_out_slot;
2285 2285