[LU-1229] test-framework not able to set module parameters from modprobe.conf Created: 16/Mar/12  Updated: 16/Apr/13  Resolved: 16/Apr/13

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.1.0, Lustre 2.2.0, Lustre 2.1.1
Fix Version/s: Lustre 2.4.0

Type: Bug Priority: Minor
Reporter: Alexey Lyashkov Assignee: Keith Mannthey (Inactive)
Resolution: Fixed Votes: 0
Labels: patch

Story Points: 1
Severity: 3
Rank (Obsolete): 6432

 Description   

Loading modules from /Users/shadow/work/lustre/work/BUGS/CLSTR-136/lustre/lustre/tests/..
../libcfs/libcfs/libcfs options: 'libcfs_debug_mb=100 options libcfs libcfs_debug=-1 options libcfs libcfs_subsystem_debug=-1 options libcfs libcfs_panic_on_lbug=0'
insmod: error inserting '/Users/shadow/work/lustre/work/BUGS/CLSTR-136/lustre/lustre/tests/../../libcfs/libcfs/libcfs.ko': -1 Unknown symbol in module

that is result more then one parameter in modprobe.conf

  1. cat /etc/modprobe.d/Lustre
    options libcfs libcfs_debug_mb=100
    options libcfs libcfs_debug=-1
    options libcfs libcfs_subsystem_debug=-1
    options libcfs libcfs_panic_on_lbug=0

options mdt mdt_num_threads=5



 Comments   
Comment by Andreas Dilger [ 16/Mar/12 ]

Looks like this should be straightforward to fix. The current code in load_module() does:

            set -- $(grep -P "^options\\s+${BASE}" $MODPROBECONF)
            # Get rid of "options $module"
            (($# > 0)) && shift 2

but it could do something like the following to handle multi-line options:

            set -- $(grep "^options[ \t]*$BASE" | sed -e 's/.*$BASE//')
Comment by Alexey Lyashkov [ 16/Mar/12 ]
--- a/lustre/tests/test-framework.sh
+++ b/lustre/tests/test-framework.sh
@@ -278,6 +278,8 @@ module_loaded () {
 #
 load_module() {
     local optvar
+    local opt
+
     EXT=".ko"
     module=$1
     shift
@@ -294,18 +296,18 @@ load_module() {
         eval set -- \$$optvar
         if [ $# -eq 0 -a -n "$MODPROBECONF" ]; then
             # Nothing in $MODOPTS_<MODULE>; try modprobe.conf
-            set -- $(grep -P "^options\\s+${BASE}" $MODPROBECONF)
+            opt=$(grep -P "^options\\s+${BASE}" $MODPROBECONF | sed -e "s/options\(\\s\)\+${BASE}/ /g")
             # Get rid of "options $module"
-            (($# > 0)) && shift 2
+            #(($# > 0)) && shift 2
 
             # Ensure we have accept=all for lnet
             if [ $(basename $module) = lnet ]; then
                 # OK, this is a bit wordy...
                 local arg accept_all_present=false
-                for arg in "$@"; do
+                for arg in "$opt"; do
                     [ "$arg" = accept=all ] && accept_all_present=true
                 done
-                $accept_all_present || set -- "$@" accept=all
+                $accept_all_present || set -- "$opt" accept=all
             fi
         fi
     fi
@@ -318,14 +320,14 @@ load_module() {
             [ -f ${LUSTRE}/../lnet/selftest/${module}${EXT} ]; then
         insmod ${LUSTRE}/../lnet/selftest/${module}${EXT}
     elif [ -f ${LUSTRE}/${module}${EXT} ]; then
-        insmod ${LUSTRE}/${module}${EXT} "$@"
+        insmod ${LUSTRE}/${module}${EXT} "$opt"
     else
         # must be testing a "make install" or "rpm" installation
         # note failed to load ptlrpc_gss is considered not fatal
         if [ "$BASE" == "ptlrpc_gss" ]; then
-            modprobe $BASE "$@" 2>/dev/null || echo "gss/krb5 is not supported"
+            modprobe $BASE "$opt" 2>/dev/null || echo "gss/krb5 is not supported"
         else
-            modprobe $BASE "$@"
+            modprobe $BASE "$opt"
         fi
     fi
 }
Comment by Alexey Lyashkov [ 16/Mar/12 ]

i didn't like plays with "$@"

Comment by Alexey Lyashkov [ 17/Mar/12 ]

remote: New Changes:
remote: http://review.whamcloud.com/2342
remote:

Comment by Keith Mannthey (Inactive) [ 16/Oct/12 ]

Alexey, Are you going to peruse acceptance of this code?

Comment by James A Simmons [ 15/Nov/12 ]

Seeing some problem with this code. A shell debug run shows this:

load_module ptlrpc/gss/ptlrpc_gss
+ local optvar
+ EXT=.ko
+ module=ptlrpc/gss/ptlrpc_gss
+ shift
++ basename ptlrpc/gss/ptlrpc_gss .ko
+ BASE=ptlrpc_gss
+ module_loaded ptlrpc_gss
+ /sbin/lsmod
+ grep -q '^\<ptlrpc_gss\>'
+ '[' 0 -eq 0 ']'
++ basename ptlrpc/gss/ptlrpc_gss
++ tr a-z A-Z
+ optvar=MODOPTS_PTLRPC_GSS
++ set –
+ '[' 0 -eq 0 -a -n /etc/modprobe.d/lustre.conf ']'
+ local opt
++ grep -P '^options\s+ptlrpc_gss' /etc/modprobe.d/lustre.conf
+ opt=

Then its stops running

Comment by James A Simmons [ 15/Nov/12 ]

My system really doesn't like that grep. What I found that does work is

local opt
opt=$(awk '/^\option.*BASE/

{print substr($3, index($3,$N))}

' $MODPROBECONF)
set – $(echo $opt | sed -e "s/\n/ /g")

As a side note I tested this with conf-sanity 53 to see if it fixed it, Nope
That set of test uses it own functions to manage the modprobe options. I'm hoping
we can cleanup this up with this patch.

Comment by Alexey Lyashkov [ 16/Nov/12 ]

James,

did you system is debian based?
but anyway that for finding solution - i will repost a patch.

Comment by James A Simmons [ 16/Nov/12 ]

No its a RHEL6 image. Mind you its a stripped down image. Besides this fix I'm investigation why config-sanity 53 fails dues to modprobe options. I hope to have fix for that as well.

Comment by Nathan Rutman [ 21/Nov/12 ]

Xyratex-bug-id: MRP-657

Comment by James A Simmons [ 30/Nov/12 ]

Found the problem Alexey. My bash environment was turning off globing. Anyways I have a patch at

Patch at http://review.whamcloud.com/#change,2342

Comment by Andreas Dilger [ 20/Dec/12 ]

Patch is landed to master.

Generated at Sat Feb 10 01:14:45 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.