From 2e443c33f31bef01c69408061bc2a6564eaa8ba1 Mon Sep 17 00:00:00 2001 From: Chris Horn Date: Wed, 30 Mar 2022 13:35:23 -0500 Subject: [PATCH] LU-15852 lnet: Don't modify uptodate peer with temp NI When processing the config log it is possible that we attempt to add temp NIs after discovery has completed on a peer. These temp may not actually exist on the peer. Since discovery has already completed the peer is considered up-to-date and we can end up with incorrect peer entries. We shouldn't add temp NIs to a peer that is already up-to-date. Lustre-change: https://review.whamcloud.com/47322 Lustre-commit: 8f718df474e453fbc69dfe90214e71565963f6db Test-Parameters: trivial testlist=sanity-lnet Signed-off-by: Chris Horn Change-Id: Ia484713b1e6c9e1a46e525589b7c741c6478e417 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/49303 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo --- lnet/lnet/peer.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lnet/lnet/peer.c b/lnet/lnet/peer.c index beec750..48a1de2 100644 --- a/lnet/lnet/peer.c +++ b/lnet/lnet/peer.c @@ -1704,6 +1704,7 @@ out: */ int lnet_add_peer_ni(lnet_nid_t prim_nid, lnet_nid_t nid, bool mr, bool temp) +__must_hold(&the_lnet.ln_api_mutex) { struct lnet_peer *lp = NULL; struct lnet_peer_ni *lpni; @@ -1755,6 +1756,13 @@ lnet_add_peer_ni(lnet_nid_t prim_nid, lnet_nid_t nid, bool mr, bool temp) return -EPERM; } + if (temp && lnet_peer_is_uptodate(lp)) { + CDEBUG(D_NET, + "Don't add temporary peer NI for uptodate peer %s\n", + libcfs_nid2str(prim_nid)); + return -EINVAL; + } + return lnet_peer_add_nid(lp, nid, flags); } -- 1.8.3.1