[lustre-devel] [PATCH 333/622] lnet: Do not allow deleting of router nis

James Simmons jsimmons at infradead.org
Thu Feb 27 13:13:21 PST 2020


From: Amir Shehata <ashehata at whamcloud.com>

Check the peer before deleting a peer_ni. If it's a router then do
not allow deletion of the peer-ni.

WC-bug-id: https://jira.whamcloud.com/browse/LU-11551
Lustre-commit: 7832a9f52d90 ("LU-11551 lnet: Do not allow deleting of router nis")
Signed-off-by: Amir Shehata <ashehata at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/33448
Reviewed-by: Olaf Weber <olaf.weber at hpe.com>
Reviewed-by: Sebastien Buisson <sbuisson at ddn.com>
Reviewed-by: Chris Horn <hornc at cray.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 net/lnet/lnet/peer.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/lnet/lnet/peer.c b/net/lnet/lnet/peer.c
index faaf94a..cb70bc7 100644
--- a/net/lnet/lnet/peer.c
+++ b/net/lnet/lnet/peer.c
@@ -1550,6 +1550,15 @@ struct lnet_peer_net *
 		return -ENODEV;
 	}
 
+	lnet_net_lock(LNET_LOCK_EX);
+	if (lp->lp_rtr_refcount > 0) {
+		lnet_net_unlock(LNET_LOCK_EX);
+		CERROR("%s is a router. Can not be deleted\n",
+		       libcfs_nid2str(prim_nid));
+		return -EBUSY;
+	}
+	lnet_net_unlock(LNET_LOCK_EX);
+
 	if (nid == LNET_NID_ANY || nid == lp->lp_primary_nid)
 		return lnet_peer_del(lp);
 
-- 
1.8.3.1



More information about the lustre-devel mailing list