From 0fa5515b8bcfc310d5cfea30b81fdd3b09e26bcc Mon Sep 17 00:00:00 2001 From: Chris Horn Date: Thu, 6 Jun 2024 15:43:09 -0600 Subject: [PATCH] LU-17914 lnet: Fix erroneous net set error lnetctl net set --health command reports a false error. This is because in lnet_genl_parse_local_ni() the last value stored in rc is from nla_strscpy() which can return a positive value. Test-Parameters: trivial testlist=sanity-lnet Fixes: fff650726b ("LU-13642 lnet: Allow dynamic IP specification") Signed-off-by: Chris Horn Change-Id: I86211a1083af4b225076f966d2e0c7793589a33a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55344 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Frank Sehr Reviewed-by: Oleg Drokin --- lnet/lnet/api-ni.c | 1 + lustre/tests/sanity-lnet.sh | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 605111a..fadf9d4 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -6249,6 +6249,7 @@ lnet_genl_parse_local_ni(struct nlattr *entry, struct genl_info *info, } } else if (info->nlhdr->nlmsg_flags & NLM_F_REPLACE && healthv != -1) { lnet_ni_set_healthv(&nid, healthv); + rc = 0; } else if (!(info->nlhdr->nlmsg_flags & (NLM_F_CREATE | NLM_F_REPLACE))) { struct lnet_ni *ni; diff --git a/lustre/tests/sanity-lnet.sh b/lustre/tests/sanity-lnet.sh index 9d91754..546c562 100755 --- a/lustre/tests/sanity-lnet.sh +++ b/lustre/tests/sanity-lnet.sh @@ -1888,8 +1888,10 @@ function lnet_health_post() { restore_lnet_params - do_lnetctl peer set --health 1000 --all - do_lnetctl net set --health 1000 --all + do_lnetctl peer set --health 1000 --all || + error "Failed to set peer health rc $?" + do_lnetctl net set --health 1000 --all || + error "Failed to set local NI health rc $?" return 0 } @@ -2445,7 +2447,8 @@ test_210() { error "Failed to add drop rule" $LCTL net_drop_add -s *@${NETTYPE}1 -d *@${NETTYPE}1 -r 1 || error "Failed to add drop rule" - do_lnetctl net set --health 0 --nid $prim_nid + do_lnetctl net set --health 0 --nid $prim_nid || + error "Failed to set NI health to 0 rc $?" check_ping_count "ni" "$prim_nid" "2" "10" check_nid_in_recovq "-l" "$prim_nid" "1" @@ -2483,7 +2486,8 @@ test_210() { error "Failed to add drop rule" $LCTL net_drop_add -s *@${NETTYPE}1 -d *@${NETTYPE}1 -r 1 || error "Failed to add drop rule" - do_lnetctl net set --health 0 --nid $prim_nid + do_lnetctl net set --health 0 --nid $prim_nid || + error "Failed to set NI health to 0 rc $?" check_ping_count "ni" "$prim_nid" "2" "10" check_nid_in_recovq "-l" "$prim_nid" "1" -- 1.8.3.1