Whamcloud - gitweb
LU-18893 lnet: Use negative errno for ERR_PTR 69/58669/3
authorChris Horn <chris.horn@hpe.com>
Thu, 3 Apr 2025 19:13:51 +0000 (13:13 -0600)
committerOleg Drokin <green@whamcloud.com>
Wed, 16 Apr 2025 20:45:41 +0000 (20:45 +0000)
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>
lnet/lnet/api-ni.c
lustre/tests/sanity-lnet.sh

index 1ea0ff1..f6a2b42 100644 (file)
@@ -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
index ee04c1f..1ee5e06 100755 (executable)
@@ -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