diff mbox series

[03/22] lnet: Don't modify uptodate peer with temp NI

Message ID 1668953828-10909-4-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: backport OpenSFS work as of Nov 20, 2022 | expand

Commit Message

James Simmons Nov. 20, 2022, 2:16 p.m. UTC
From: Chris Horn <chris.horn@hpe.com>

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.

HPE-bug-id: LUS-10867
WC-bug-id: https://jira.whamcloud.com/browse/LU-15852
Lustre-commit: 8f718df474e453fbc ("LU-15852 lnet: Don't modify uptodate peer with temp NI")
Signed-off-by: Chris Horn <chris.horn@hpe.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/47322
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 net/lnet/lnet/peer.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/net/lnet/lnet/peer.c b/net/lnet/lnet/peer.c
index d8d1857..52ad791 100644
--- a/net/lnet/lnet/peer.c
+++ b/net/lnet/lnet/peer.c
@@ -1855,6 +1855,7 @@  struct lnet_peer_net *
 int
 lnet_add_peer_ni(struct lnet_nid *prim_nid, struct lnet_nid *nid, bool mr,
 		 bool temp)
+__must_hold(&the_lnet.ln_api_mutex)
 {
 	struct lnet_peer *lp = NULL;
 	struct lnet_peer_ni *lpni;
@@ -1906,6 +1907,13 @@  struct lnet_peer_net *
 		return -EPERM;
 	}
 
+	if (temp && lnet_peer_is_uptodate(lp)) {
+		CDEBUG(D_NET,
+		       "Don't add temporary peer NI for uptodate peer %s\n",
+		       libcfs_nidstr(&lp->lp_primary_nid));
+		return -EINVAL;
+	}
+
 	return lnet_peer_add_nid(lp, nid, flags);
 }