[lustre-devel] [PATCH 07/34] lnet: lnet_peer_tables_cleanup: use an exclusive lock.

NeilBrown neilb at suse.com
Mon Sep 24 18:07:15 PDT 2018


Why?? surely this will deadlock.

This is part of
    Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")
from upstream lustre, where it is marked:
    Signed-off-by: Amir Shehata <amir.shehata at intel.com>
    WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
    Reviewed-on: http://review.whamcloud.com/18293
    Reviewed-by: Olaf Weber <olaf at sgi.com>
    Reviewed-by: Doug Oucharek <doug.s.oucharek at intel.com>

Signed-off-by: NeilBrown <neilb at suse.com>
---
 drivers/staging/lustre/lnet/lnet/peer.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/peer.c b/drivers/staging/lustre/lnet/lnet/peer.c
index 53b0ca0a2021..376e3459fa92 100644
--- a/drivers/staging/lustre/lnet/lnet/peer.c
+++ b/drivers/staging/lustre/lnet/lnet/peer.c
@@ -185,9 +185,9 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)
 	 * peers are gateways for.
 	 */
 	cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) {
-		lnet_net_lock(i);
+		lnet_net_lock(LNET_LOCK_EX);
 		lnet_peer_table_del_rtrs_locked(ni, ptable, i);
-		lnet_net_unlock(i);
+		lnet_net_unlock(LNET_LOCK_EX);
 	}
 
 	/*
@@ -195,17 +195,17 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)
 	 * deathrow.
 	 */
 	cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) {
-		lnet_net_lock(i);
+		lnet_net_lock(LNET_LOCK_EX);
 		lnet_peer_table_cleanup_locked(ni, ptable);
-		lnet_net_unlock(i);
+		lnet_net_unlock(LNET_LOCK_EX);
 	}
 
 	/* Cleanup all entries on deathrow. */
 	cfs_percpt_for_each(ptable, i, the_lnet.ln_peer_tables) {
-		lnet_net_lock(i);
+		lnet_net_lock(LNET_LOCK_EX);
 		lnet_peer_table_deathrow_wait_locked(ptable, i);
 		list_splice_init(&ptable->pt_deathrow, &deathrow);
-		lnet_net_unlock(i);
+		lnet_net_unlock(LNET_LOCK_EX);
 	}
 
 	while (!list_empty(&deathrow)) {




More information about the lustre-devel mailing list