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>
}
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;
/* 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;