From: Bruno Faccini Date: Wed, 5 Nov 2014 19:38:04 +0000 (-0800) Subject: LU-5830 scripts: use lustre_rmmod in lnet start/stop script X-Git-Tag: 2.5.3.90~16 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=e5966bdbb7c7644cc04580ad6b4a9006def3f758 LU-5830 scripts: use lustre_rmmod in lnet start/stop script In lnet's start/stop script stop phase, use lustre_rmmod instead to try to unload a static list/sequence of modules. This patch is back-ported from the following one: Lustre-commit: f882ceaa28d5c0fb2f018102468656d9b7adc637 Lustre-change: http://review.whamcloud.com/12513 Signed-off-by: Bruno Faccini Change-Id: Ida7093e10b198c73a4cd8ca539f4b803dd998e00 Reviewed-on: http://review.whamcloud.com/12587 Reviewed-by: Brian J. Murrell Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/lustre/scripts/lnet b/lustre/scripts/lnet index 99f568d..2213f89 100644 --- a/lustre/scripts/lnet +++ b/lustre/scripts/lnet @@ -18,33 +18,6 @@ # Check for and source configuration file otherwise set defaults [ -f /etc/sysconfig/lnet ] && . /etc/sysconfig/lnet -declare -r TOP_MODULES=( \ - obdecho \ - llite \ - lustre \ - osc \ - lov \ - mds \ - mdc \ - mgs \ - mgc \ - ost \ - obdfilter \ - lquota \ - ptlrpc \ -) -declare -r BOTTOM_MODULES=( \ - ksocklnd \ - kqswlnd \ - ko2iblnd \ - fsfilt_ldiskfs \ - obdclass \ - lnet \ - lvfs \ - libcfs \ - ldiskfs \ -) - declare -r awkprog='BEGIN { rc = -1 } { if ( $1 == module_name ) { rc = $3; exit; } } END { print rc }' @@ -79,44 +52,9 @@ run_postexec_check () fi } -remove_modules () -{ - local modules="${@}" - local ref_cnt - - for mod in $modules; do - ref_cnt=`/sbin/lsmod | awk "$awkprog" "module_name=$mod"` - if [ $ref_cnt -lt 0 ]; then - # module not loaded, skip it - continue - fi - if [ $ref_cnt -gt 0 ]; then - # module in use. maybe it just needs a few seconds - # after removal of previous modules. - sleep 5 - ref_cnt=`/sbin/lsmod | awk "$awkprog" module_name=$mod` - fi - if [ $ref_cnt -eq 0 ]; then - # unload the module - echo "Removing module $mod" - /sbin/rmmod $mod - if [ $? -ne 0 ]; then - echo "ERROR: Failed to remove module $mod." - return 1 - fi - else - # boo! module still in use. - echo "ERROR: Module $mod has non-zero reference count." - return 1 - fi - done - - return 0 -} - stop_lnet () { - local errmsg=`/usr/sbin/lctl network unconfigure 2>&1` + local errmsg=$(/usr/sbin/lctl network down 2>&1) if [ $? -gt 0 ]; then # The following error message means that lnet is already # unconfigured, and the modules are not loaded. @@ -188,9 +126,8 @@ case "$1" in ;; stop) run_preexec_check "stop" - remove_modules ${TOP_MODULES[*]} || exit 1 stop_lnet || exit 1 - remove_modules ${BOTTOM_MODULES[*]} || exit 1 + lustre_rmmod || exit 1 rm -f /var/lock/subsys/lnet run_postexec_check "stop" ;;