Whamcloud - gitweb
LU-11551 lnet: Do not allow deleting of router nis 48/33448/27
authorAmir Shehata <ashehata@whamcloud.com>
Fri, 19 Oct 2018 23:40:52 +0000 (16:40 -0700)
committerAmir Shehata <ashehata@whamcloud.com>
Fri, 7 Jun 2019 18:12:28 +0000 (18:12 +0000)
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 <ashehata@whamcloud.com>
Change-Id: I372052b4e9b5af3a8f18a49676fc60b4c8077cbd
Reviewed-on: https://review.whamcloud.com/33448
Reviewed-by: Olaf Weber <olaf.weber@hpe.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Chris Horn <hornc@cray.com>
Tested-by: Jenkins
lnet/lnet/peer.c

index d818a71..9e95805 100644 (file)
@@ -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);