Whamcloud - gitweb
LU-13454 lnet: Handle health stats for reply to optimized GET 37/38237/2
authorChris Horn <hornc@cray.com>
Tue, 14 Apr 2020 19:00:27 +0000 (14:00 -0500)
committerOleg Drokin <green@whamcloud.com>
Thu, 23 Apr 2020 16:49:06 +0000 (16:49 +0000)
The LNet messages used for replies to optimized GETs, created via
lnet_create_reply_msg(), are only ever committed for rx. As such,
their msg_txni and msg_txpeer fields are NULL. lnet_incr_hstats()
does not account for this situation, so when passed one of these
messages attempts to deref a NULL pointer.

HPE-bug-id: LUS-8730
Signed-off-by: Chris Horn <hornc@cray.com>
Change-Id: I36b7c46a2d439c5e62f17df64a4f9da8f01090aa
Reviewed-on: https://review.whamcloud.com/38237
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Amir Shehata <ashehata@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/lib-msg.c

index 93058cd..e8c6025 100644 (file)
@@ -539,10 +539,9 @@ lnet_handle_remote_failure(struct lnet_peer_ni *lpni)
 }
 
 static void
-lnet_incr_hstats(struct lnet_msg *msg, enum lnet_msg_hstatus hstatus)
+lnet_incr_hstats(struct lnet_ni *ni, struct lnet_peer_ni *lpni,
+                enum lnet_msg_hstatus hstatus)
 {
-       struct lnet_ni *ni = msg->msg_txni;
-       struct lnet_peer_ni *lpni = msg->msg_txpeer;
        struct lnet_counters_health *health;
 
        health = &the_lnet.ln_counters[0]->lct_health;
@@ -804,16 +803,6 @@ lnet_health_check(struct lnet_msg *msg)
                return -1;
 
        /*
-        * stats are only incremented for errors so avoid wasting time
-        * incrementing statistics if there is no error.
-        */
-       if (hstatus != LNET_MSG_STATUS_OK) {
-               lnet_net_lock(0);
-               lnet_incr_hstats(msg, hstatus);
-               lnet_net_unlock(0);
-       }
-
-       /*
         * always prefer txni/txpeer if they message is committed for both
         * directions.
         */
@@ -836,6 +825,16 @@ lnet_health_check(struct lnet_msg *msg)
               lnet_msgtyp2str(msg->msg_type),
               lnet_health_error2str(hstatus));
 
+       /*
+        * stats are only incremented for errors so avoid wasting time
+        * incrementing statistics if there is no error.
+        */
+       if (hstatus != LNET_MSG_STATUS_OK) {
+               lnet_net_lock(0);
+               lnet_incr_hstats(ni, lpni, hstatus);
+               lnet_net_unlock(0);
+       }
+
        switch (hstatus) {
        case LNET_MSG_STATUS_OK:
                /*