From: Mr NeilBrown Date: Mon, 11 May 2020 03:52:34 +0000 (+1000) Subject: LU-10391 socklnd: don't deref lnet_hdr in LNDs X-Git-Tag: 2.14.57~18 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=321fe9fa12d244bb70a6662d3d4d9a6c1709fe3e;p=fs%2Flustre-release.git LU-10391 socklnd: don't deref lnet_hdr in LNDs The lnd_hdr structure needs to be extended to support larger addresses. To assist this we need to minimize the number of places that its content are accessed. Currently the internals of lnet_hdr are larely untouched inside the various LNDs, but there are some exceptions in socklnd. These exceptions are not necessary - the same data is available from elsewhere in the lnet_msg. So change those accesses to use the lnet_msg info instead. Test-Parameters: trivial Test-Parameters: serverversion=2.12 serverdistro=el7.9 testlist=runtests Test-Parameters: clientversion=2.12 testlist=runtests Signed-off-by: Mr NeilBrown Change-Id: Ia37548323fafc77df7a42a1ac956c926f1b9ebf9 Reviewed-on: https://review.whamcloud.com/43602 Reviewed-by: Andreas Dilger Reviewed-by: Serguei Smirnov Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lnet/klnds/socklnd/socklnd_cb.c b/lnet/klnds/socklnd/socklnd_cb.c index b098210..3ad0eee 100644 --- a/lnet/klnds/socklnd/socklnd_cb.c +++ b/lnet/klnds/socklnd/socklnd_cb.c @@ -425,12 +425,12 @@ ksocknal_txlist_done(struct lnet_ni *ni, struct list_head *txlist, int error) while ((tx = list_first_entry_or_null(txlist, struct ksock_tx, tx_list)) != NULL) { - if (error && tx->tx_lnetmsg != NULL) { + if (error && tx->tx_lnetmsg) { CNETERR("Deleting packet type %d len %d %s->%s\n", - le32_to_cpu(tx->tx_lnetmsg->msg_hdr.type), - le32_to_cpu(tx->tx_lnetmsg->msg_hdr.payload_length), - libcfs_nid2str(le64_to_cpu(tx->tx_lnetmsg->msg_hdr.src_nid)), - libcfs_nid2str(le64_to_cpu(tx->tx_lnetmsg->msg_hdr.dest_nid))); + tx->tx_lnetmsg->msg_type, + tx->tx_lnetmsg->msg_len, + libcfs_nidstr(&tx->tx_lnetmsg->msg_initiator), + libcfs_nidstr(&tx->tx_lnetmsg->msg_target.nid)); } else if (error) { CNETERR("Deleting noop packet\n"); } @@ -770,10 +770,9 @@ ksocknal_queue_tx_locked(struct ksock_tx *tx, struct ksock_conn *conn) LASSERT(tx->tx_niov >= 1); LASSERT(tx->tx_resid == tx->tx_nob); - CDEBUG (D_NET, "Packet %p type %d, nob %d niov %d nkiov %d\n", - tx, (tx->tx_lnetmsg != NULL) ? tx->tx_lnetmsg->msg_hdr.type: - KSOCK_MSG_NOOP, - tx->tx_nob, tx->tx_niov, tx->tx_nkiov); + CDEBUG(D_NET, "Packet %p type %d, nob %d niov %d nkiov %d\n", + tx, tx->tx_lnetmsg ? tx->tx_lnetmsg->msg_type : KSOCK_MSG_NOOP, + tx->tx_nob, tx->tx_niov, tx->tx_nkiov); bufnob = conn->ksnc_sock->sk->sk_wmem_queued; spin_lock_bh(&sched->kss_lock);