From 6e76d3569bf602d71745b8151417cff7ddfd7df4 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Mon, 3 Feb 2025 10:16:56 -0500 Subject: [PATCH] LU-12511 lnet: rework lnd module loading The kernel IS_MODULE() only works in the positive, ie no ifndef. So rework the LND module loading code to handle if modules are enabled. Test-Parameters: trivial testlist=sanity-lnet Change-Id: Ie97b00b6b5c21d6e20acf72f796707630369251e Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57946 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Frank Sehr Reviewed-by: Serguei Smirnov Reviewed-by: Chris Horn Reviewed-by: Oleg Drokin --- lnet/lnet/api-ni.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 19f191b..1b47621 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -2606,21 +2606,22 @@ static const struct lnet_lnd *lnet_load_lnd(u32 lnd_type) mutex_lock(&the_lnet.ln_lnd_mutex); lnd = lnet_find_lnd_by_type(lnd_type); if (!lnd) { +#ifdef HAVE_MODULE_LOADING_SUPPORT mutex_unlock(&the_lnet.ln_lnd_mutex); rc = request_module("%s", libcfs_lnd2modname(lnd_type)); mutex_lock(&the_lnet.ln_lnd_mutex); lnd = lnet_find_lnd_by_type(lnd_type); if (!lnd) { - mutex_unlock(&the_lnet.ln_lnd_mutex); CERROR("Can't load LND %s, module %s, rc=%d\n", libcfs_lnd2str(lnd_type), libcfs_lnd2modname(lnd_type), rc); -#ifndef HAVE_MODULE_LOADING_SUPPORT - LCONSOLE_ERROR("Your kernel must be compiled with kernel module loading support."); -#endif - return ERR_PTR(-EINVAL); + lnd = ERR_PTR(rc); } +#else + LCONSOLE_ERROR("Your kernel must be compiled with kernel module loading support."); + lnd = ERR_PTR(-EINVAL); +#endif } mutex_unlock(&the_lnet.ln_lnd_mutex); -- 1.8.3.1