diff mbox series

[12/18] lnet: socklnd: switch ksocknal_del_peer to lnet_processid

Message ID 1654777994-29806-13-git-send-email-jsimmons@infradead.org (mailing list archive)
State Not Applicable
Headers show
Series lustre: sync with OpenSFS tree June 8, 2022 | expand

Commit Message

James Simmons June 9, 2022, 12:33 p.m. UTC
From: Mr NeilBrown <neilb@suse.de>

ksocknal_del_peer now takes a pointer to a lnet_processid,
with room for a large address.
A NULL means "ANY NID, AND PID".
The "ip" argument was completely unused, so has been removed.

This was the last use of 'struct lnet_process_id' in ksocklnd.

WC-bug-id: https://jira.whamcloud.com/browse/LU-10391
Lustre-commit: 782e37e54f5c54886 ("LU-10391 socklnd: switch ksocknal_del_peer to lnet_processid")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/44623
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 net/lnet/klnds/socklnd/socklnd.c | 36 +++++++++++++-----------------------
 1 file changed, 13 insertions(+), 23 deletions(-)
diff mbox series

Patch

diff --git a/net/lnet/klnds/socklnd/socklnd.c b/net/lnet/klnds/socklnd/socklnd.c
index 857aa05..01b434f 100644
--- a/net/lnet/klnds/socklnd/socklnd.c
+++ b/net/lnet/klnds/socklnd/socklnd.c
@@ -660,7 +660,7 @@  struct ksock_peer_ni *
 }
 
 static void
-ksocknal_del_peer_locked(struct ksock_peer_ni *peer_ni, u32 ip)
+ksocknal_del_peer_locked(struct ksock_peer_ni *peer_ni)
 {
 	struct ksock_conn *conn;
 	struct ksock_conn *cnxt;
@@ -683,7 +683,7 @@  struct ksock_peer_ni *
 }
 
 static int
-ksocknal_del_peer(struct lnet_ni *ni, struct lnet_process_id id4, u32 ip)
+ksocknal_del_peer(struct lnet_ni *ni, struct lnet_processid *id)
 {
 	LIST_HEAD(zombies);
 	struct hlist_node *pnxt;
@@ -692,15 +692,11 @@  struct ksock_peer_ni *
 	int hi;
 	int i;
 	int rc = -ENOENT;
-	struct lnet_processid id;
-
-	id.pid = id4.pid;
-	lnet_nid4_to_nid(id4.nid, &id.nid);
 
 	write_lock_bh(&ksocknal_data.ksnd_global_lock);
 
-	if (!LNET_NID_IS_ANY(&id.nid)) {
-		lo = hash_min(nidhash(&id.nid),
+	if (id && !LNET_NID_IS_ANY(&id->nid)) {
+		lo = hash_min(nidhash(&id->nid),
 			      HASH_BITS(ksocknal_data.ksnd_peers));
 		hi = lo;
 	} else {
@@ -715,15 +711,15 @@  struct ksock_peer_ni *
 			if (peer_ni->ksnp_ni != ni)
 				continue;
 
-			if (!((LNET_NID_IS_ANY(&id.nid) ||
-			       nid_same(&peer_ni->ksnp_id.nid, &id.nid)) &&
-			      (id.pid == LNET_PID_ANY ||
-			       peer_ni->ksnp_id.pid == id.pid)))
+			if (!((!id || LNET_NID_IS_ANY(&id->nid) ||
+			       nid_same(&peer_ni->ksnp_id.nid, &id->nid)) &&
+			      (!id || id->pid == LNET_PID_ANY ||
+			       peer_ni->ksnp_id.pid == id->pid)))
 				continue;
 
 			ksocknal_peer_addref(peer_ni);     /* a ref for me... */
 
-			ksocknal_del_peer_locked(peer_ni, ip);
+			ksocknal_del_peer_locked(peer_ni);
 
 			if (peer_ni->ksnp_closing &&
 			    !list_empty(&peer_ni->ksnp_tx_queue)) {
@@ -1764,7 +1760,6 @@  static int ksocknal_push(struct lnet_ni *ni, struct lnet_processid *id)
 int
 ksocknal_ctl(struct lnet_ni *ni, unsigned int cmd, void *arg)
 {
-	struct lnet_process_id id4 = {};
 	struct lnet_processid id = {};
 	struct libcfs_ioctl_data *data = arg;
 	int rc;
@@ -1832,10 +1827,9 @@  static int ksocknal_push(struct lnet_ni *ni, struct lnet_processid *id)
 		return ksocknal_add_peer(ni, &id, (struct sockaddr *)&sa);
 	}
 	case IOC_LIBCFS_DEL_PEER:
-		id4.nid = data->ioc_nid;
-		id4.pid = LNET_PID_ANY;
-		return ksocknal_del_peer(ni, id4,
-					 data->ioc_u32[0]); /* IP */
+		lnet_nid4_to_nid(data->ioc_nid, &id.nid);
+		id.pid = LNET_PID_ANY;
+		return ksocknal_del_peer(ni, &id);
 
 	case IOC_LIBCFS_GET_CONN: {
 		int txmem;
@@ -2347,10 +2341,6 @@  static int ksocknal_inetaddr_event(struct notifier_block *unused,
 ksocknal_shutdown(struct lnet_ni *ni)
 {
 	struct ksock_net *net = ni->ni_data;
-	struct lnet_process_id anyid = { 0 };
-
-	anyid.nid = LNET_NID_ANY;
-	anyid.pid = LNET_PID_ANY;
 
 	LASSERT(ksocknal_data.ksnd_init == SOCKNAL_INIT_ALL);
 	LASSERT(ksocknal_data.ksnd_nnets > 0);
@@ -2359,7 +2349,7 @@  static int ksocknal_inetaddr_event(struct notifier_block *unused,
 	atomic_add(SOCKNAL_SHUTDOWN_BIAS, &net->ksnn_npeers);
 
 	/* Delete all peers */
-	ksocknal_del_peer(ni, anyid, 0);
+	ksocknal_del_peer(ni, NULL);
 
 	/* Wait for all peer_ni state to clean up */
 	wait_var_event_warning(&net->ksnn_npeers,