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
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);