rbd: release client list lock sooner
authorAlex Elder <elder@dreamhost.com>
Sun, 29 Jan 2012 19:57:44 +0000 (13:57 -0600)
committerAlex Elder <elder@dreamhost.com>
Thu, 22 Mar 2012 15:47:47 +0000 (10:47 -0500)
In rbd_get_client(), if a client is reused, a number of things
get done while still holding the list lock unnecessarily.

This just moves a few things that need no lock protection outside
the lock.

Signed-off-by: Alex Elder <elder@dreamhost.com>
Signed-off-by: Sage Weil <sage@newdream.net>
drivers/block/rbd.c

index 9ac1484..bccd350 100644 (file)
@@ -383,13 +383,15 @@ static int rbd_get_client(struct rbd_device *rbd_dev, const char *mon_addr,
        spin_lock(&node_lock);
        rbdc = __rbd_client_find(opt);
        if (rbdc) {
-               ceph_destroy_options(opt);
-               kfree(rbd_opts);
-
                /* using an existing client */
                kref_get(&rbdc->kref);
-               rbd_dev->rbd_client = rbdc;
                spin_unlock(&node_lock);
+
+               rbd_dev->rbd_client = rbdc;
+
+               ceph_destroy_options(opt);
+               kfree(rbd_opts);
+
                return 0;
        }
        spin_unlock(&node_lock);