From 7832a9f52d9078e2b22a3047a1ca5e9474ec00b7 Mon Sep 17 00:00:00 2001 From: Amir Shehata Date: Fri, 19 Oct 2018 16:40:52 -0700 Subject: [PATCH] LU-11551 lnet: Do not allow deleting of router nis Check the peer before deleting a peer_ni. If it's a router then do not allow deletion of the peer-ni. Test-Parameters: forbuildonly Signed-off-by: Amir Shehata Change-Id: I372052b4e9b5af3a8f18a49676fc60b4c8077cbd Reviewed-on: https://review.whamcloud.com/33448 Reviewed-by: Olaf Weber Reviewed-by: Sebastien Buisson Reviewed-by: Chris Horn Tested-by: Jenkins --- lnet/lnet/peer.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lnet/lnet/peer.c b/lnet/lnet/peer.c index d818a71..9e95805 100644 --- a/lnet/lnet/peer.c +++ b/lnet/lnet/peer.c @@ -1556,6 +1556,15 @@ lnet_del_peer_ni(lnet_nid_t prim_nid, lnet_nid_t nid) 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