drbd: rcu_read_[un]lock() for all idr accesses that do not sleep
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 563427b..5abbdaf 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -453,8 +453,10 @@
}
/* ensure bit indicating barrier is required is clear */
+ rcu_read_lock();
idr_for_each_entry(&tconn->volumes, mdev, vnr)
clear_bit(CREATE_BARRIER, &mdev->flags);
+ rcu_read_unlock();
spin_unlock_irq(&tconn->req_lock);
}
@@ -634,13 +636,15 @@
int conn_lowest_minor(struct drbd_tconn *tconn)
{
- int vnr = 0;
struct drbd_conf *mdev;
+ int vnr = 0, m;
+ rcu_read_lock();
mdev = idr_get_next(&tconn->volumes, &vnr);
- if (!mdev)
- return -1;
- return mdev_to_minor(mdev);
+ m = mdev ? mdev_to_minor(mdev) : -1;
+ rcu_read_unlock();
+
+ return m;
}
#ifdef CONFIG_SMP