Whamcloud - gitweb
LU-9919 lnet: safe access in debug print 71/28771/3
authorAmir Shehata <amir.shehata@intel.com>
Mon, 28 Aug 2017 22:09:21 +0000 (15:09 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 6 Feb 2018 04:27:11 +0000 (04:27 +0000)
Move debug print within the cpt lock to keep
peer access safe.

Test-Parameters: trivial
Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Change-Id: Ic37ff0973367b3eb9cbc0059ffee9c31ecf98c34
Reviewed-on: https://review.whamcloud.com/28771
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/lnet/lib-move.c

index a2938b7..e0014c2 100644 (file)
@@ -1599,11 +1599,10 @@ again:
                msg->msg_rtr_nid_param = rtr_nid;
                msg->msg_sending = 0;
                list_add_tail(&msg->msg_list, &peer->lp_dc_pendq);
-               lnet_peer_ni_decref_locked(lpni);
-               lnet_net_unlock(cpt);
-
                CDEBUG(D_NET, "%s pending discovery\n",
                       libcfs_nid2str(peer->lp_primary_nid));
+               lnet_peer_ni_decref_locked(lpni);
+               lnet_net_unlock(cpt);
 
                return LNET_DC_WAIT;
        }
@@ -1738,10 +1737,10 @@ again:
                                best_lpni->lpni_net->net_id, cpt);
                        /* If there is no best_ni we don't have a route */
                        if (!best_ni) {
-                               lnet_net_unlock(cpt);
                                CERROR("no path to %s from net %s\n",
                                        libcfs_nid2str(best_lpni->lpni_nid),
                                        libcfs_net2str(best_lpni->lpni_net->net_id));
+                               lnet_net_unlock(cpt);
                                return -EHOSTUNREACH;
                        }
                        lpni = list_entry(peer_net->lpn_peer_nis.next,
@@ -1896,9 +1895,9 @@ pick_peer:
                 * move onto the next peer_ni in the peer
                 */
                if (!best_gw) {
-                       lnet_net_unlock(cpt);
                        LCONSOLE_WARN("No route to peer from %s\n",
                                libcfs_nid2str(best_ni->ni_nid));
+                       lnet_net_unlock(cpt);
                        return -EHOSTUNREACH;
                }