From 1dd3cb834d28dfe554c000c0276f17bb8271758c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 6 Jan 2013 09:44:06 +0000 Subject: [PATCH] /etc/init.d/scst: Wait up to 30s before giving up trying to unload a kernel module (merge r4608 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4689 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scstadmin/init.d/scst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scstadmin/init.d/scst b/scstadmin/init.d/scst index a316b3b67..abeaa46e2 100755 --- a/scstadmin/init.d/scst +++ b/scstadmin/init.d/scst @@ -181,7 +181,12 @@ unload_scst() { # occurs, sleep for a short time. sleep 1 fi - if [ -e /sys/module/$m/refcnt ] && ! rmmod $m; then + i=0 + while [ -e /sys/module/$m/refcnt ] && ! rmmod $m && [ $i -lt 30 ]; do + sleep 1 + i=$((i+1)) + done + if [ -e /sys/module/$m/refcnt ]; then return 1 fi done