lustre-devel-lustre.org archive mirror
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: Andreas Dilger <adilger@whamcloud.com>,
	Oleg Drokin <green@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: Chris Horn <chris.horn@hpe.com>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 11/15] lustre: obdclass: Add peer/peer NI when processing llog
Date: Sun, 22 Aug 2021 22:27:42 -0400	[thread overview]
Message-ID: <1629685666-4533-12-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1629685666-4533-1-git-send-email-jsimmons@infradead.org>

From: Chris Horn <chris.horn@hpe.com>

Construct peers when processing the config log so that LNet has
complete information about peer info stored in the config log.

These are "temporary" peers which can be overwritten by discovery.

In client_import_add_nids_to_conn(), we do not need to hold the
import lock when adding NIDs to the obd_uuid, and LNet needs to take
the LNet API mutex when adding/modifying peers. We don't want to take
the mutex while a spin lock is already being held, so drop the spin
lock prior to calling class_add_nids_to_uuid().

HPE-bug-id: LUS-9293
WC-bug-id: https://jira.whamcloud.com/browse/LU-14661
Lustre-commit: 16321de596f63951 ("LU-14661 obdclass: Add peer/peer NI when processing llog")
Signed-off-by: Chris Horn <chris.horn@hpe.com>
Reviewed-on: https://review.whamcloud.com/43510
Reviewed-by: Alexander Boyko <alexander.boyko@hpe.com>
Reviewed-by: Sergey Cheremencev <sergey.cheremencev@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ldlm/ldlm_lib.c        |  3 ++-
 fs/lustre/obdclass/lustre_peer.c | 18 +++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/fs/lustre/ldlm/ldlm_lib.c b/fs/lustre/ldlm/ldlm_lib.c
index c5ee2c3..90bad71 100644
--- a/fs/lustre/ldlm/ldlm_lib.c
+++ b/fs/lustre/ldlm/ldlm_lib.c
@@ -173,9 +173,10 @@ int client_import_add_nids_to_conn(struct obd_import *imp, lnet_nid_t *nids,
 	list_for_each_entry(conn, &imp->imp_conn_list, oic_item) {
 		if (class_check_uuid(&conn->oic_uuid, nids[0])) {
 			*uuid = conn->oic_uuid;
+			spin_unlock(&imp->imp_lock);
 			rc = class_add_nids_to_uuid(&conn->oic_uuid, nids,
 						    nid_count);
-			break;
+			return rc;
 		}
 	}
 	spin_unlock(&imp->imp_lock);
diff --git a/fs/lustre/obdclass/lustre_peer.c b/fs/lustre/obdclass/lustre_peer.c
index c0a0bfb..f7e6a0f 100644
--- a/fs/lustre/obdclass/lustre_peer.c
+++ b/fs/lustre/obdclass/lustre_peer.c
@@ -81,6 +81,7 @@ int class_add_uuid(const char *uuid, u64 nid)
 {
 	struct uuid_nid_data *data, *entry;
 	int found = 0;
+	int rc;
 
 	LASSERT(nid != 0);  /* valid newconfig NID is never zero */
 
@@ -119,9 +120,15 @@ int class_add_uuid(const char *uuid, u64 nid)
 	if (found) {
 		CDEBUG(D_INFO, "found uuid %s %s cnt=%d\n", uuid,
 		       libcfs_nid2str(nid), entry->un_nid_count);
+		rc = LNetAddPeer(entry->un_nids, entry->un_nid_count);
+		CDEBUG(D_INFO, "Add peer %s rc = %d\n",
+		       libcfs_nid2str(data->un_nids[0]), rc);
 		kfree(data);
 	} else {
 		CDEBUG(D_INFO, "add uuid %s %s\n", uuid, libcfs_nid2str(nid));
+		rc = LNetAddPeer(data->un_nids, data->un_nid_count);
+		CDEBUG(D_INFO, "Add peer %s rc = %d\n",
+		       libcfs_nid2str(data->un_nids[0]), rc);
 	}
 	return 0;
 }
@@ -173,7 +180,8 @@ int class_add_nids_to_uuid(struct obd_uuid *uuid, lnet_nid_t *nids,
 			   int nid_count)
 {
 	struct uuid_nid_data *entry;
-	int i;
+	int i, rc;
+	bool matched = false;
 
 	if (nid_count >= MTI_NIDS_MAX) {
 		CDEBUG(D_NET, "too many NIDs (%d) for UUID '%s'\n",
@@ -188,6 +196,8 @@ int class_add_nids_to_uuid(struct obd_uuid *uuid, lnet_nid_t *nids,
 
 		if (!obd_uuid_equals(&entry->un_uuid, uuid))
 			continue;
+
+		matched = true;
 		CDEBUG(D_NET, "Updating UUID '%s'\n", obd_uuid2str(uuid));
 		for (i = 0; i < nid_count; i++)
 			entry->un_nids[i] = nids[i];
@@ -195,6 +205,12 @@ int class_add_nids_to_uuid(struct obd_uuid *uuid, lnet_nid_t *nids,
 		break;
 	}
 	spin_unlock(&g_uuid_lock);
+	if (matched) {
+		rc = LNetAddPeer(entry->un_nids, entry->un_nid_count);
+		CDEBUG(D_INFO, "Add peer %s rc = %d\n",
+		       libcfs_nid2str(entry->un_nids[0]), rc);
+	}
+
 	return 0;
 }
 EXPORT_SYMBOL(class_add_nids_to_uuid);
-- 
1.8.3.1

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

  parent reply	other threads:[~2021-08-23  2:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23  2:27 [lustre-devel] [PATCH 00/15] lustre: sync to OpenSFS as of Aug 22, 2021 James Simmons
2021-08-23  2:27 ` [lustre-devel] [PATCH 01/15] lustre: uapi: support fixed directory layout James Simmons
2021-08-23  2:27 ` [lustre-devel] [PATCH 02/15] lustre: pcc: add LCM_FL_PCC_RDONLY layout flag James Simmons
2021-08-23  2:27 ` [lustre-devel] [PATCH 03/15] lustre: mdt: implement fallocate in MDC/MDT James Simmons
2021-08-23  2:27 ` [lustre-devel] [PATCH 04/15] lnet: Reflect ni_fatal in NI status James Simmons
2021-08-23  2:27 ` [lustre-devel] [PATCH 05/15] lustre: obdclass: reintroduce lu_ref James Simmons
2021-08-23  2:27 ` [lustre-devel] [PATCH 06/15] lnet: keep in insync to change due to GPU Direct Support James Simmons
2021-08-23  2:27 ` [lustre-devel] [PATCH 07/15] lustre: osc: Support RDMA only pages James Simmons
2021-08-23  2:27 ` [lustre-devel] [PATCH 08/15] lustre: mgc: rework mgc_apply_recover_logs() for gcc10 James Simmons
2021-08-23  2:27 ` [lustre-devel] [PATCH 09/15] lnet: socklnd: allow dynamic setting of conns_per_peer James Simmons
2021-08-23  2:27 ` [lustre-devel] [PATCH 10/15] lnet: Provide kernel API for adding peers James Simmons
2021-08-23  2:27 ` James Simmons [this message]
2021-08-23  2:27 ` [lustre-devel] [PATCH 12/15] lnet: peer state to lock primary nid James Simmons
2021-08-23  2:27 ` [lustre-devel] [PATCH 13/15] lustre: llite: Proved an abstraction for AS_EXITING James Simmons
2021-08-23  2:27 ` [lustre-devel] [PATCH 14/15] lnet: socklnd: set conns_per_peer based on link speed James Simmons
2021-08-23  2:27 ` [lustre-devel] [PATCH 15/15] lustre: update version to 2.14.54 James Simmons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1629685666-4533-12-git-send-email-jsimmons@infradead.org \
    --to=jsimmons@infradead.org \
    --cc=adilger@whamcloud.com \
    --cc=chris.horn@hpe.com \
    --cc=green@whamcloud.com \
    --cc=lustre-devel@lists.lustre.org \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).