diff options
author | Alex Elder <elder@dreamhost.com> | 2012-01-29 13:57:44 -0600 |
---|---|---|
committer | Alex Elder <elder@dreamhost.com> | 2012-03-22 10:47:47 -0500 |
commit | d97081b0c7bdb55371994cc6690217bf393eb63e (patch) | |
tree | a520fd2d821202175749fc9a0dd9b1b4a1fa2ac8 /drivers/block | |
parent | e6994d3ddedf1a9f35cb43655bb4b5810e71199a (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/block')
-rw-r--r-- | drivers/block/rbd.c | 6 |
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, } spin_unlock(&node_lock); + mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); rbdc = rbd_client_create(opt, rbd_opts); + mutex_unlock(&ctl_mutex); + if (IS_ERR(rbdc)) { ret = PTR_ERR(rbdc); goto done_err; @@ -2276,10 +2279,7 @@ static ssize_t rbd_add(struct bus_type *bus, /* initialize rest of new object */ snprintf(rbd_dev->name, DEV_NAME_LEN, DRV_NAME "%d", rbd_dev->id); - mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); rc = rbd_get_client(rbd_dev, mon_dev_name, options); - mutex_unlock(&ctl_mutex); - if (rc < 0) goto err_out_slot; |