From: Chris Horn Date: Thu, 3 Apr 2025 19:13:51 +0000 (-0600) Subject: LU-18893 lnet: Use negative errno for ERR_PTR X-Git-Tag: 2.16.55~112 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=969a680544e630183c5cbbb5b38effe505459bc0;p=fs%2Flustre-release.git LU-18893 lnet: Use negative errno for ERR_PTR request_module() can return a positive value from modprobe. If this happens then we need to provide a negative errno for ERR_PTR(). Test-Parameters: trivial testlist=sanity-lnet Fixes: 6e76d3569b ("LU-12511 lnet: rework lnd module loading ") Signed-off-by: Chris Horn Change-Id: I400aa5b350fe274d18c2edb38479bb428907efb6 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58669 Reviewed-by: Oleg Drokin Reviewed-by: Serguei Smirnov Reviewed-by: Cyril Bordage Reviewed-by: James Simmons Tested-by: jenkins Tested-by: Maloo --- diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 1ea0ff1..f6a2b42 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -2617,6 +2617,8 @@ static const struct lnet_lnd *lnet_load_lnd(u32 lnd_type) CERROR("Can't load LND %s, module %s, rc=%d\n", libcfs_lnd2str(lnd_type), libcfs_lnd2modname(lnd_type), rc); + if (rc >= 0) + rc = -EINVAL; lnd = ERR_PTR(rc); } #else diff --git a/lustre/tests/sanity-lnet.sh b/lustre/tests/sanity-lnet.sh index ee04c1f..1ee5e06 100755 --- a/lustre/tests/sanity-lnet.sh +++ b/lustre/tests/sanity-lnet.sh @@ -4211,6 +4211,34 @@ test_260() { } run_test 260 "test that linux sysctl parameter are set correctly" +test_280() { + local rc=0 + + modinfo ksocklnd 2>/dev/null || rc=$? + + ((rc == 1)) || skip "Need request_module to fail" + + local lnd="" + + case $NETTYPE in + o2ib*) lnd=ko2iblnd;; + tcp*) lnd=ksocklnd;; + kfi*) lnd=kkfilnd;; + gni*) lnd=kgnilnd;; + esac + + [[ -n $lnd ]] || skip "Unsupported NETTYPE $NETTYPE" + + load_lnet || error "Failed to load lnet" + + $LUSTRE_RMMOD $lnd || error "Failed to unload $lnd" + + $LNETCTL lnet configure -a + + $LUSTRE_RMMOD +} +run_test 280 "Don't panic when request_module fails" + test_300() { # LU-13274 local header