From af3c6b5a4b68d6754dc35efa034721f33feb205d Mon Sep 17 00:00:00 2001 From: Serguei Smirnov Date: Tue, 24 Nov 2020 16:05:48 -0800 Subject: [PATCH] LU-13929 lnet: modify assertion in lnet_post_send_locked Check that the pointer to the local interface is not NULL before asserting. While checking if local ni is the destination, the assertion may attempt to dereference pointer to local interface after it has already been cleaned up on shutdown. Lustre-change: https://review.whamcloud.com/40749 Lustre-commit: e5a8f3fc12840aee97fca03d76b1ae9b4572acb8 Test-Parameters: trivial testlist=sanity-lnet Signed-off-by: Serguei Smirnov Change-Id: I0f4be04a728a7243823bec70f9efbe52bcb104b3 Reviewed-on: https://review.whamcloud.com/48265 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lnet/lnet/lib-move.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lnet/lnet/lib-move.c b/lnet/lnet/lib-move.c index b67036b..87fad88 100644 --- a/lnet/lnet/lib-move.c +++ b/lnet/lnet/lib-move.c @@ -841,8 +841,10 @@ lnet_post_send_locked(struct lnet_msg *msg, int do_send) LASSERT(!do_send || msg->msg_tx_delayed); LASSERT(!msg->msg_receiving); LASSERT(msg->msg_tx_committed); + /* can't get here if we're sending to the loopback interface */ - LASSERT(lp->lpni_nid != the_lnet.ln_loni->ni_nid); + if (the_lnet.ln_loni) + LASSERT(lp->lpni_nid != the_lnet.ln_loni->ni_nid); /* NB 'lp' is always the next hop */ if ((msg->msg_target.pid & LNET_PID_USERFLAG) == 0 && @@ -1739,6 +1741,9 @@ lnet_handle_lo_send(struct lnet_send_data *sd) struct lnet_msg *msg = sd->sd_msg; int cpt = sd->sd_cpt; + if (the_lnet.ln_state != LNET_STATE_RUNNING) + return -ESHUTDOWN; + /* No send credit hassles with LOLND */ lnet_ni_addref_locked(the_lnet.ln_loni, cpt); msg->msg_hdr.dest_nid = cpu_to_le64(the_lnet.ln_loni->ni_nid); -- 1.8.3.1