From 1c250cbfa127a15176f8ce91a2102bff51d54dac Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Sat, 20 Aug 2022 13:30:25 -0400 Subject: [PATCH] LU-10391 ptlrpc: change rq_source to struct lnet_nid rq_source in struct ptlrpc_request can now store large NIDs. ptl_send_buf() now takes a struct lnet_processid for the peer. Signed-off-by: Mr NeilBrown Change-Id: I2fe7da2332955c69f6252d44fb3ae28d2ef4e517 Reviewed-on: https://review.whamcloud.com/44639 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Frank Sehr Reviewed-by: James Simmons Reviewed-by: Chris Horn Reviewed-by: Oleg Drokin --- lustre/include/lustre_net.h | 2 +- lustre/ptlrpc/events.c | 4 ++-- lustre/ptlrpc/gss/gss_svc_upcall.c | 8 +++----- lustre/ptlrpc/niobuf.c | 16 +++++++--------- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index cd1acc9..2e35734 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -1115,7 +1115,7 @@ struct ptlrpc_request { /** Peer description (the other side) */ struct lnet_processid rq_peer; /** Descriptor for the NID from which the peer sent the request. */ - struct lnet_process_id rq_source; + struct lnet_processid rq_source; /** * service time estimate (secs) * If the request is not served by this time, it is marked as timed out. diff --git a/lustre/ptlrpc/events.c b/lustre/ptlrpc/events.c index 19a0009..61542ac 100644 --- a/lustre/ptlrpc/events.c +++ b/lustre/ptlrpc/events.c @@ -349,7 +349,7 @@ void request_in_callback(struct lnet_event *ev) ktime_get_real_ts64(&req->rq_arrival_time); /* Multi-Rail: keep track of both initiator and source NID. */ req->rq_peer = ev->initiator; - req->rq_source = lnet_pid_to_pid4(&ev->source); + req->rq_source = ev->source; req->rq_self = ev->target.nid; req->rq_rqbd = rqbd; req->rq_phase = RQ_PHASE_NEW; @@ -358,7 +358,7 @@ void request_in_callback(struct lnet_event *ev) req, req->rq_xid, ev->mlength); CDEBUG(D_RPCTRACE, "peer: %s (source: %s)\n", - libcfs_idstr(&req->rq_peer), libcfs_id2str(req->rq_source)); + libcfs_idstr(&req->rq_peer), libcfs_idstr(&req->rq_source)); spin_lock(&svcpt->scp_lock); diff --git a/lustre/ptlrpc/gss/gss_svc_upcall.c b/lustre/ptlrpc/gss/gss_svc_upcall.c index da84fad..07b8b2e 100644 --- a/lustre/ptlrpc/gss/gss_svc_upcall.c +++ b/lustre/ptlrpc/gss/gss_svc_upcall.c @@ -910,18 +910,16 @@ int gss_svc_upcall_handle_init(struct ptlrpc_request *req, struct gss_rep_header *rephdr; int first_check = 1; int rc = SECSVC_DROP; - struct lnet_nid primary; - ENTRY; + ENTRY; memset(&rsikey, 0, sizeof(rsikey)); rsikey.lustre_svc = lustre_svc; /* In case of MR, rq_peer is not the NID from which request is received, * but primary NID of peer. * So we need LNetPrimaryNID(rq_source) to match what the clients uses. */ - lnet_nid4_to_nid(req->rq_source.nid, &primary); - LNetPrimaryNID(&primary); - rsikey.nid4 = lnet_nid_to_nid4(&primary); + LNetPrimaryNID(&req->rq_source.nid); + rsikey.nid4 = lnet_nid_to_nid4(&req->rq_source.nid); nodemap_test_nid(lnet_nid_to_nid4(&req->rq_peer.nid), rsikey.nm_name, sizeof(rsikey.nm_name)); diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index 735b0a5..8986986 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -46,21 +46,19 @@ */ static int ptl_send_buf(struct lnet_handle_md *mdh, void *base, int len, enum lnet_ack_req ack, struct ptlrpc_cb_id *cbid, - lnet_nid_t self4, struct lnet_process_id peer_id4, + lnet_nid_t self4, struct lnet_processid *peer_id, int portal, __u64 xid, unsigned int offset, struct lnet_handle_md *bulk_cookie) { int rc; struct lnet_md md; struct lnet_nid self; - struct lnet_processid peer_id; ENTRY; lnet_nid4_to_nid(self4, &self); - lnet_pid4_to_pid(peer_id4, &peer_id); LASSERT(portal != 0); - CDEBUG(D_INFO, "peer_id %s\n", libcfs_id2str(peer_id4)); + CDEBUG(D_INFO, "peer_id %s\n", libcfs_idstr(peer_id)); md.start = base; md.length = len; md.threshold = (ack == LNET_ACK_REQ) ? 2 : 1; @@ -93,14 +91,14 @@ static int ptl_send_buf(struct lnet_handle_md *mdh, void *base, int len, percpu_ref_get(&ptlrpc_pending); rc = LNetPut(&self, *mdh, ack, - &peer_id, portal, xid, offset, 0); + peer_id, portal, xid, offset, 0); if (unlikely(rc != 0)) { int rc2; /* We're going to get an UNLINK event when I unlink below, * which will complete just like any other failed send, so * I fall through and return success here! */ CERROR("LNetPut(%s, %d, %lld) failed: %d\n", - libcfs_id2str(peer_id4), portal, xid, rc); + libcfs_idstr(peer_id), portal, xid, rc); rc2 = LNetMDUnlink(*mdh); LASSERTF(rc2 == 0, "rc2 = %d\n", rc2); } @@ -189,7 +187,7 @@ int ptlrpc_start_bulk_transfer(struct ptlrpc_bulk_desc *desc) * message. */ self_nid = desc->bd_req->rq_self; - lnet_pid4_to_pid(desc->bd_req->rq_source, &peer_id); + peer_id = desc->bd_req->rq_source; /* NB total length may be 0 for a read past EOF, so we send 0 * length bulks, since the client expects bulk events. @@ -650,7 +648,7 @@ int ptlrpc_send_reply(struct ptlrpc_request *req, int flags) (rs->rs_difficult && !rs->rs_no_ack) ? LNET_ACK_REQ : LNET_NOACK_REQ, &rs->rs_cb_id, lnet_nid_to_nid4(&req->rq_self), - req->rq_source, + &req->rq_source, ptlrpc_req2svc(req)->srv_rep_portal, req->rq_rep_mbits ? req->rq_rep_mbits : req->rq_xid, req->rq_reply_off, NULL); @@ -945,7 +943,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) request->rq_reqbuf, request->rq_reqdata_len, LNET_NOACK_REQ, &request->rq_req_cbid, LNET_NID_ANY, - lnet_pid_to_pid4(&connection->c_peer), + &connection->c_peer, request->rq_request_portal, request->rq_xid, 0, &bulk_cookie); if (likely(rc == 0)) -- 1.8.3.1