Whamcloud - gitweb
LU-10391 socklnd: don't deref lnet_hdr in LNDs 02/43602/12
authorMr NeilBrown <neilb@suse.de>
Mon, 11 May 2020 03:52:34 +0000 (13:52 +1000)
committerOleg Drokin <green@whamcloud.com>
Tue, 18 Jan 2022 09:08:47 +0000 (09:08 +0000)
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 <neilb@suse.de>
Change-Id: Ia37548323fafc77df7a42a1ac956c926f1b9ebf9
Reviewed-on: https://review.whamcloud.com/43602
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/klnds/socklnd/socklnd_cb.c

index b098210..3ad0eee 100644 (file)
@@ -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) {
 
        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",
                        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");
                }
                } 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);
 
        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);
 
        bufnob = conn->ksnc_sock->sk->sk_wmem_queued;
        spin_lock_bh(&sched->kss_lock);