aboutsummaryrefslogtreecommitdiff
path: root/drivers/block/drbd/drbd_main.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2011-05-04 15:47:01 +0200
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-08 16:55:47 +0100
commitec0bddbc5574ea5903cec8f30ed57777f14d86a8 (patch)
tree681645e03c7c526e8ecc990d90d75d6e7a5f77a7 /drivers/block/drbd/drbd_main.c
parent81fa2e675ccf88035d9308a3c98fe2c2928ace00 (diff)
downloadlinux-ec0bddbc5574ea5903cec8f30ed57777f14d86a8.tar.gz
drbd: Use RCU for the drbd_tconns list
Preparing removal of drbd_cfg_rwsem Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_main.c')
-rw-r--r--drivers/block/drbd/drbd_main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 8da0e99ee7e..771b53ece97 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2341,7 +2341,7 @@ static void drbd_cleanup(void)
}
list_for_each_entry_safe(tconn, tmp, &drbd_tconns, all_tconn) {
- list_del(&tconn->all_tconn);
+ list_del_rcu(&tconn->all_tconn);
synchronize_rcu();
kref_put(&tconn->kref, &conn_destroy);
}
@@ -2409,7 +2409,7 @@ struct drbd_tconn *conn_get_by_name(const char *name)
return NULL;
down_read(&drbd_cfg_rwsem);
- list_for_each_entry(tconn, &drbd_tconns, all_tconn) {
+ list_for_each_entry_rcu(tconn, &drbd_tconns, all_tconn) {
if (!strcmp(tconn->name, name)) {
kref_get(&tconn->kref);
goto found;
@@ -2459,6 +2459,7 @@ void conn_free_crypto(struct drbd_tconn *tconn)
tconn->int_dig_vv = NULL;
}
+/* caller must be under genl_lock() */
struct drbd_tconn *conn_create(const char *name)
{
struct drbd_tconn *tconn;
@@ -2503,7 +2504,7 @@ struct drbd_tconn *conn_create(const char *name)
down_write(&drbd_cfg_rwsem);
kref_init(&tconn->kref);
- list_add_tail(&tconn->all_tconn, &drbd_tconns);
+ list_add_tail_rcu(&tconn->all_tconn, &drbd_tconns);
up_write(&drbd_cfg_rwsem);
return tconn;