}
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);
}
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;
tconn->int_dig_vv = NULL;
}
+/* caller must be under genl_lock() */
struct drbd_tconn *conn_create(const char *name)
{
struct drbd_tconn *tconn;
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;
/* synchronize with conn_create()/conn_destroy() */
down_read(&drbd_cfg_rwsem);
/* revalidate iterator position */
- list_for_each_entry(tmp, &drbd_tconns, all_tconn) {
+ list_for_each_entry_rcu(tmp, &drbd_tconns, all_tconn) {
if (pos == NULL) {
/* first iteration */
pos = tmp;
if (!mdev) {
/* No more volumes to dump on this tconn.
* Advance tconn iterator. */
- pos = list_entry(tconn->all_tconn.next,
- struct drbd_tconn, all_tconn);
+ pos = list_entry_rcu(tconn->all_tconn.next,
+ struct drbd_tconn, all_tconn);
/* Did we dump any volume on this tconn yet? */
if (volume != 0) {
/* If we reached the end of the list,
/* delete connection */
if (conn_lowest_minor(adm_ctx.tconn) < 0) {
- list_del(&adm_ctx.tconn->all_tconn);
+ list_del_rcu(&adm_ctx.tconn->all_tconn);
+ synchronize_rcu();
kref_put(&adm_ctx.tconn->kref, &conn_destroy);
retcode = NO_ERROR;
down_write(&drbd_cfg_rwsem);
if (conn_lowest_minor(adm_ctx.tconn) < 0) {
- list_del(&adm_ctx.tconn->all_tconn);
+ list_del_rcu(&adm_ctx.tconn->all_tconn);
+ synchronize_rcu();
kref_put(&adm_ctx.tconn->kref, &conn_destroy);
retcode = NO_ERROR;