Whamcloud - gitweb
LU-13929 lnet: modify assertion in lnet_post_send_locked 49/40749/4
authorSerguei Smirnov <ssmirnov@whamcloud.com>
Wed, 25 Nov 2020 00:05:48 +0000 (16:05 -0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 26 Feb 2021 08:23:35 +0000 (08:23 +0000)
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.

Test-Parameters: trivial
Signed-off-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Change-Id: I0f4be04a728a7243823bec70f9efbe52bcb104b3
Reviewed-on: https://review.whamcloud.com/40749
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/lib-move.c

index 5757b82..f69b21f 100644 (file)
@@ -840,8 +840,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);
        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 */
        /* 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 &&
 
        /* NB 'lp' is always the next hop */
        if ((msg->msg_target.pid & LNET_PID_USERFLAG) == 0 &&
@@ -1761,6 +1763,9 @@ lnet_handle_lo_send(struct lnet_send_data *sd)
        struct lnet_msg *msg = sd->sd_msg;
        int cpt = sd->sd_cpt;
 
        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);
        /* 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);