From: Mr NeilBrown Date: Tue, 8 Nov 2022 21:13:59 +0000 (-0500) Subject: LU-10391 lnet: change lnet_notify() to take struct lnet_nid X-Git-Tag: 2.15.53~68 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=4a88236f40a47c05d0cc6a253dcfc105427987f4;p=fs%2Flustre-release.git LU-10391 lnet: change lnet_notify() to take struct lnet_nid lnet_notify() now takes a 'struct lnet_nid *' instead of a lnet_nid_t. Test-Parameters: trivial testlist=sanity-lnet Test-Parameters: serverversion=2.12 serverdistro=el7.9 testlist=runtests Test-Parameters: clientversion=2.12 testlist=runtests Signed-off-by: Mr NeilBrown Change-Id: I4c3ab0eea5202028ee881eee04bdd1014f7f150d Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/44633 Reviewed-by: Chris Horn Reviewed-by: Serguei Smirnov Reviewed-by: Frank Sehr Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index cab038a..39af59d 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -622,8 +622,8 @@ extern int portal_rotor; void lnet_mt_event_handler(struct lnet_event *event); -int lnet_notify(struct lnet_ni *ni, lnet_nid_t peer, bool alive, bool reset, - time64_t when); +int lnet_notify(struct lnet_ni *ni, struct lnet_nid *peer, bool alive, + bool reset, time64_t when); void lnet_notify_locked(struct lnet_peer_ni *lp, int notifylnd, int alive, time64_t when); int lnet_add_route(__u32 net, __u32 hops, struct lnet_nid *gateway, diff --git a/lnet/klnds/gnilnd/gnilnd.c b/lnet/klnds/gnilnd/gnilnd.c index c9880f9..b785b13 100644 --- a/lnet/klnds/gnilnd/gnilnd.c +++ b/lnet/klnds/gnilnd/gnilnd.c @@ -592,19 +592,20 @@ kgnilnd_peer_notify(kgn_peer_t *peer, int error, int alive) up_read(&kgnilnd_data.kgn_net_rw_sem); for (i = 0; i < nnets; i++) { - lnet_nid_t peer_nid; + struct lnet_nid peer_nid; net = nets[i]; - peer_nid = kgnilnd_lnd2lnetnid( - lnet_nid_to_nid4(&net->gnn_ni->ni_nid), - peer->gnp_nid); + lnet_nid4_to_nid(kgnilnd_lnd2lnetnid( + lnet_nid_to_nid4(&net->gnn_ni->ni_nid), + peer->gnp_nid), + &peer_nid); CDEBUG(D_NET, "peer 0x%p->%s last_alive %lld (%llds ago)\n", peer, libcfs_nid2str(peer_nid), peer->gnp_last_alive, ktime_get_seconds() - peer->gnp_last_alive); - lnet_notify(net->gnn_ni, peer_nid, alive, true, + lnet_notify(net->gnn_ni, &peer_nid, alive, true, peer->gnp_last_alive); kgnilnd_net_decref(net); diff --git a/lnet/klnds/gnilnd/gnilnd_conn.c b/lnet/klnds/gnilnd/gnilnd_conn.c index 38dce1d..d95e15f 100644 --- a/lnet/klnds/gnilnd/gnilnd_conn.c +++ b/lnet/klnds/gnilnd/gnilnd_conn.c @@ -1777,6 +1777,7 @@ kgnilnd_finish_connect(kgn_dgram_t *dgram) { kgn_conn_t *conn = dgram->gndg_conn; lnet_nid_t her_nid = dgram->gndg_conn_in.gncr_srcnid; + struct lnet_nid peer_nid; kgn_peer_t *new_peer, *peer = NULL; kgn_tx_t *tx; kgn_tx_t *txn; @@ -1952,7 +1953,8 @@ kgnilnd_finish_connect(kgn_dgram_t *dgram) /* Notify LNET that we now have a working connection to this peer. * This is a Cray extension to the "standard" LND behavior. */ - lnet_notify(peer->gnp_net->gnn_ni, peer->gnp_nid, true, true, + lnet_nid4_to_nid(peer->gnp_nid, &peer_nid); + lnet_notify(peer->gnp_net->gnn_ni, &peed_nid, true, true, ktime_get_seconds()); /* drop our 'hold' ref */ diff --git a/lnet/klnds/kfilnd/kfilnd_peer.c b/lnet/klnds/kfilnd/kfilnd_peer.c index e38f9d3..f2dc2fe 100644 --- a/lnet/klnds/kfilnd/kfilnd_peer.c +++ b/lnet/klnds/kfilnd/kfilnd_peer.c @@ -62,10 +62,13 @@ static void kfilnd_peer_free(void *ptr, void *arg) void kfilnd_peer_down(struct kfilnd_peer *peer) { if (atomic_cmpxchg(&peer->remove_peer, 0, 1) == 0) { + struct lnet_nid peer_nid; + + lnet_nid4_to_nid(peer->nid, &peer_nid); CDEBUG(D_NET, "%s(0x%llx) marked for removal from peer cache\n", - libcfs_nid2str(peer->nid), peer->addr); + libcfs_nidstr(&peer_nid), peer->addr); - lnet_notify(peer->dev->kfd_ni, peer->nid, false, false, + lnet_notify(peer->dev->kfd_ni, &peer_nid, false, false, peer->last_alive); } } diff --git a/lnet/klnds/o2iblnd/o2iblnd_cb.c b/lnet/klnds/o2iblnd/o2iblnd_cb.c index 71a7ccb..fbe7536 100644 --- a/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -2055,7 +2055,7 @@ kiblnd_peer_alive(struct kib_peer_ni *peer_ni) static void kiblnd_peer_notify(struct kib_peer_ni *peer_ni) { - int error = 0; + int error = 0; time64_t last_alive = 0; unsigned long flags; @@ -2070,9 +2070,13 @@ kiblnd_peer_notify(struct kib_peer_ni *peer_ni) read_unlock_irqrestore(&kiblnd_data.kib_global_lock, flags); - if (error != 0) - lnet_notify(peer_ni->ibp_ni, - peer_ni->ibp_nid, false, false, last_alive); + if (error != 0) { + struct lnet_nid nid; + + lnet_nid4_to_nid(peer_ni->ibp_nid, &nid); + lnet_notify(peer_ni->ibp_ni, &nid, + false, false, last_alive); + } } void diff --git a/lnet/klnds/socklnd/socklnd.c b/lnet/klnds/socklnd/socklnd.c index 2c844c0..84e176f 100644 --- a/lnet/klnds/socklnd/socklnd.c +++ b/lnet/klnds/socklnd/socklnd.c @@ -1413,7 +1413,7 @@ ksocknal_peer_failed(struct ksock_peer_ni *peer_ni) if (notify) lnet_notify(peer_ni->ksnp_ni, - lnet_nid_to_nid4(&peer_ni->ksnp_id.nid), + &peer_ni->ksnp_id.nid, false, false, last_alive); } diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 7f8e04e..6e0a99e 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -4447,7 +4447,8 @@ LNetCtl(unsigned int cmd, void *arg) * that deadline to the wall clock. */ deadline += ktime_get_seconds(); - return lnet_notify(NULL, data->ioc_nid, data->ioc_flags, false, + lnet_nid4_to_nid(data->ioc_nid, &nid); + return lnet_notify(NULL, &nid, data->ioc_flags, false, deadline); } diff --git a/lnet/lnet/router.c b/lnet/lnet/router.c index 23c901b..c21d6bc 100644 --- a/lnet/lnet/router.c +++ b/lnet/lnet/router.c @@ -1677,27 +1677,25 @@ lnet_notify_peer_down(struct lnet_ni *ni, struct lnet_nid *nid) * when: notificaiton time. */ int -lnet_notify(struct lnet_ni *ni, lnet_nid_t nid4, bool alive, bool reset, +lnet_notify(struct lnet_ni *ni, struct lnet_nid *nid, bool alive, bool reset, time64_t when) { struct lnet_peer_ni *lpni = NULL; struct lnet_route *route; struct lnet_peer *lp; time64_t now = ktime_get_seconds(); - struct lnet_nid nid; int cpt; - lnet_nid4_to_nid(nid4, &nid); LASSERT(!in_interrupt()); CDEBUG(D_NET, "%s notifying %s: %s\n", (ni == NULL) ? "userspace" : libcfs_nidstr(&ni->ni_nid), - libcfs_nidstr(&nid), alive ? "up" : "down"); + libcfs_nidstr(nid), alive ? "up" : "down"); if (ni != NULL && - LNET_NID_NET(&ni->ni_nid) != LNET_NID_NET(&nid)) { + LNET_NID_NET(&ni->ni_nid) != LNET_NID_NET(nid)) { CWARN("Ignoring notification of %s %s by %s (different net)\n", - libcfs_nidstr(&nid), alive ? "birth" : "death", + libcfs_nidstr(nid), alive ? "birth" : "death", libcfs_nidstr(&ni->ni_nid)); return -EINVAL; } @@ -1706,7 +1704,7 @@ lnet_notify(struct lnet_ni *ni, lnet_nid_t nid4, bool alive, bool reset, if (when > now) { CWARN("Ignoring prediction from %s of %s %s %lld seconds in the future\n", ni ? libcfs_nidstr(&ni->ni_nid) : "userspace", - libcfs_nidstr(&nid), alive ? "up" : "down", when - now); + libcfs_nidstr(nid), alive ? "up" : "down", when - now); return -EINVAL; } @@ -1724,11 +1722,11 @@ lnet_notify(struct lnet_ni *ni, lnet_nid_t nid4, bool alive, bool reset, return -ESHUTDOWN; } - lpni = lnet_peer_ni_find_locked(&nid); + lpni = lnet_peer_ni_find_locked(nid); if (lpni == NULL) { /* nid not found */ lnet_net_unlock(0); - CDEBUG(D_NET, "%s not found\n", libcfs_nidstr(&nid)); + CDEBUG(D_NET, "%s not found\n", libcfs_nidstr(nid)); return 0; }