aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorAlex Elder <elder@dreamhost.com>2012-04-04 14:35:44 -0400
committerAlex Elder <elder@dreamhost.com>2012-04-05 16:43:58 -0400
commitcd9d9f5df6098c50726200d4185e9e8da32785b3 (patch)
tree94e4c7035fc7c7f6596a8f3b59fa27e19a45d4f0 /drivers/block
parentc666601a935b94cc0f3310339411b6940de751ba (diff)
rbd: don't hold spinlock during messenger flush
A recent change made changes to the rbd_client_list be protected by a spinlock. Unfortunately in rbd_put_client(), the lock is taken before possibly dropping the last reference to an rbd_client, and on the last reference that eventually calls flush_workqueue() which can sleep. The problem was flagged by a debug spinlock warning: BUG: spinlock wrong CPU on CPU#3, rbd/27814 The solution is to move the spinlock acquisition and release inside rbd_client_release(), which is the spot where it's really needed for protecting the removal of the rbd_client from the client list. Signed-off-by: Alex Elder <elder@dreamhost.com> Reviewed-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 013c7a549fb6..c1f770131654 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -450,7 +450,9 @@ static void rbd_client_release(struct kref *kref)
450 struct rbd_client *rbdc = container_of(kref, struct rbd_client, kref); 450 struct rbd_client *rbdc = container_of(kref, struct rbd_client, kref);
451 451
452 dout("rbd_release_client %p\n", rbdc); 452 dout("rbd_release_client %p\n", rbdc);
453 spin_lock(&rbd_client_list_lock);
453 list_del(&rbdc->node); 454 list_del(&rbdc->node);
455 spin_unlock(&rbd_client_list_lock);
454 456
455 ceph_destroy_client(rbdc->client); 457 ceph_destroy_client(rbdc->client);
456 kfree(rbdc->rbd_opts); 458 kfree(rbdc->rbd_opts);
@@ -463,9 +465,7 @@ static void rbd_client_release(struct kref *kref)
463 */ 465 */
464static void rbd_put_client(struct rbd_device *rbd_dev) 466static void rbd_put_client(struct rbd_device *rbd_dev)
465{ 467{
466 spin_lock(&rbd_client_list_lock);
467 kref_put(&rbd_dev->rbd_client->kref, rbd_client_release); 468 kref_put(&rbd_dev->rbd_client->kref, rbd_client_release);
468 spin_unlock(&rbd_client_list_lock);
469 rbd_dev->rbd_client = NULL; 469 rbd_dev->rbd_client = NULL;
470} 470}
471 471