drbd: Do not sleep inside rcu
authorAndreas Gruenbacher <agruen@linbit.com>
Tue, 25 Jun 2013 14:50:03 +0000 (16:50 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 28 Jun 2013 14:04:36 +0000 (16:04 +0200)
Signed-off-by: Andreas Gruenbacher <agruen@linbit.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/drbd/drbd_receiver.c

index 4222affff488bc15c116187e2eb382af5f2d0508..adee58e19e830193dde020e8905981b52c248a0d 100644 (file)
@@ -1039,6 +1039,8 @@ randomize:
        rcu_read_lock();
        idr_for_each_entry(&tconn->volumes, mdev, vnr) {
                kref_get(&mdev->kref);
+               rcu_read_unlock();
+
                /* Prevent a race between resync-handshake and
                 * being promoted to Primary.
                 *
@@ -1049,8 +1051,6 @@ randomize:
                mutex_lock(mdev->state_mutex);
                mutex_unlock(mdev->state_mutex);
 
-               rcu_read_unlock();
-
                if (discard_my_data)
                        set_bit(DISCARD_MY_DATA, &mdev->flags);
                else