From 338dbbf251e483bd86196b8ff8c7643076ac5690 Mon Sep 17 00:00:00 2001 From: Chris Horn Date: Thu, 12 Aug 2021 16:08:44 -0500 Subject: [PATCH] LU-14940 lnet: Fix source specified send to different net The destination NI is fixed for all source-specified sends. Thus, in order for a source-specified send to be considered "local", i.e. a send that does not require a route, the destination NID must be on the same net as the specified source. Lustre-change: https://review.whamcloud.com/44728 Lustre-commit: 3e3563f719ce89de28d276f3de1add064932506b HPE-bug-id: LUS-10303 Test-Parameters: trivial testlist=sanity-lnet Signed-off-by: Chris Horn Change-Id: I4847db1d393bbc36def65123f260b928ebbf944e Reviewed-on: https://review.whamcloud.com/48440 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Frank Sehr Reviewed-by: Alexandre Ioffe Reviewed-by: Andreas Dilger --- lnet/lnet/lib-move.c | 18 +++++++++++------- lustre/tests/sanity-lnet.sh | 8 ++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/lnet/lnet/lib-move.c b/lnet/lnet/lib-move.c index 4a200ba..9f4e754 100644 --- a/lnet/lnet/lib-move.c +++ b/lnet/lnet/lib-move.c @@ -2837,15 +2837,19 @@ again: /* * Identify the different send cases */ - if (src_nid == LNET_NID_ANY) + if (src_nid == LNET_NID_ANY) { send_case |= SRC_ANY; - else + if (lnet_get_net_locked(LNET_NIDNET(dst_nid))) + send_case |= LOCAL_DST; + else + send_case |= REMOTE_DST; + } else { send_case |= SRC_SPEC; - - if (lnet_get_net_locked(LNET_NIDNET(dst_nid))) - send_case |= LOCAL_DST; - else - send_case |= REMOTE_DST; + if (LNET_NIDNET(src_nid) == LNET_NIDNET(dst_nid)) + send_case |= LOCAL_DST; + else + send_case |= REMOTE_DST; + } final_hop = false; if (msg->msg_routing && (send_case & LOCAL_DST)) diff --git a/lustre/tests/sanity-lnet.sh b/lustre/tests/sanity-lnet.sh index 6b8e0bc..2b81112 100755 --- a/lustre/tests/sanity-lnet.sh +++ b/lustre/tests/sanity-lnet.sh @@ -1977,6 +1977,14 @@ test_215() { npings=$(($npings * 2)) done + # Ping from nid1 to nid2 should fail + do_lnetctl ping --source $nid1 $nid2 && + error "ping from $nid1 to $nid2 should fail" + + # Ping from nid2 to nid1 should fail + do_lnetctl ping --source $nid2 $nid1 && + error "ping from $nid2 to $nid1 should fail" + return 0 } run_test 215 "Test lnetctl ping --source option" -- 1.8.3.1