From 9be823075dd79f9584a5ed87acf5d6ef406e06db Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 23 May 2020 16:18:13 +0000 Subject: [PATCH 1/2] /etc/init.d/scst: Fix a shellcheck warning git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8950 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scstadmin/init.d/scst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scstadmin/init.d/scst b/scstadmin/init.d/scst index 7c7972e24..bb1e0c186 100755 --- a/scstadmin/init.d/scst +++ b/scstadmin/init.d/scst @@ -378,9 +378,9 @@ case "$1" in esac if [ $rc = 0 ]; then - log_success_msg + log_success_msg "" else - log_failure_msg + log_failure_msg "" fi exit $rc From 00765d8ae28fde5e53233743e3c896f9a6d701cd Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 23 May 2020 16:30:42 +0000 Subject: [PATCH 2/2] /etc/init.d/scst: Unload all SCST kernel modules Also unload SCST kernel modules that have been loaded manually or that are no longer referenced by /etc/scst.conf. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8951 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scstadmin/init.d/scst | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/scstadmin/init.d/scst b/scstadmin/init.d/scst index bb1e0c186..51966feea 100755 --- a/scstadmin/init.d/scst +++ b/scstadmin/init.d/scst @@ -171,7 +171,7 @@ unload_kmod() { m="$1" t="$2" i=0 - while [ -e "/sys/module/$m/refcnt" ] && ! rmmod "$m" 2>/dev/null && + while [ -e "/sys/module/$m/refcnt" ] && ! modprobe -r "$m" 2>/dev/null && [ $i -lt "$t" ] do sleep 1 @@ -192,30 +192,16 @@ unload_scst() { # seconds. unload_kmod isert_scst 90 || echo "Unloading isert_scst failed" - reverse_list="" + reverse_list="scst_disk scst_raid scst_tape scst_user scst_changer \ + scst_cdrom scst_vdisk scst_modisk scst_processor \ + isert_scst iscsi_scst fcst ib_srpt qla2xxx_scst qla2x00tgt \ + scst_local scst" for m in $SCST_MODULES; do reverse_list="$m $reverse_list" done for m in $reverse_list; do - refcnt=$(cat "/sys/module/$m/refcnt" 2>/dev/null) - if [ -n "$refcnt" ] && [ "$refcnt" -gt 0 ]; then - # Apparently it can happen that the iscsi_scst refcnt is only - # decremented a short time after killproc finished. If that - # occurs, sleep for a short time. - sleep 1 - fi unload_kmod "$m" 30 || return 1 done - # Loading qla2x00tgt causes qla2xxx_scst to be loaded but removing - # qla2x00tgt does not cause qla2xxx_scst to be unloaded. Hence unload it - # explicitly. - unload_kmod qla2xxx_scst - for m in $SCST_OPT_MODULES; do - reverse_list="$m $reverse_list" - done - for m in $reverse_list; do - rmmod "$m" >/dev/null 2>&1 - done # Clear the config in case unloading failed or SCST has been built into the # kernel