From: Chris Horn Date: Tue, 14 Apr 2020 19:00:27 +0000 (-0500) Subject: LU-13454 lnet: Handle health stats for reply to optimized GET X-Git-Tag: 2.13.54~172 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=a4f8f2840f81a225cf09e33dce9cba2a9a8b6526;p=fs%2Flustre-release.git LU-13454 lnet: Handle health stats for reply to optimized GET 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 Change-Id: I36b7c46a2d439c5e62f17df64a4f9da8f01090aa Reviewed-on: https://review.whamcloud.com/38237 Tested-by: jenkins Reviewed-by: Amir Shehata Reviewed-by: Serguei Smirnov Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lnet/lnet/lib-msg.c b/lnet/lnet/lib-msg.c index 93058cd..e8c6025 100644 --- a/lnet/lnet/lib-msg.c +++ b/lnet/lnet/lib-msg.c @@ -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: /*