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 <chris.horn@hpe.com>
Change-Id: I400aa5b350fe274d18c2edb38479bb428907efb6
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58669
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
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
}
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