shutdown: fixed killall_proc_mountpoint()
authorHarald Hoyer <harald@redhat.com>
Wed, 14 Aug 2013 08:33:19 +0000 (10:33 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 14 Aug 2013 13:04:05 +0000 (15:04 +0200)
modules.d/99base/dracut-lib.sh
modules.d/99shutdown/shutdown.sh

index 248cc8e..3084744 100755 (executable)
@@ -56,7 +56,7 @@ killall_proc_mountpoint() {
         esac
         [ -e "/proc/$_pid/exe" ] || continue
         [ -e "/proc/$_pid/root" ] || continue
-        strstr "$(ls -l -- '/proc/$_pid' '/proc/$_pid/fd' 2>/dev/null)" "$1" && kill -9 "$_pid"
+        strstr "$(ls -l -- "/proc/$_pid" "/proc/$_pid/fd" 2>/dev/null)" "$1" && kill -9 "$_pid"
     done
 }
 
index f040139..162abcb 100755 (executable)
@@ -68,14 +68,19 @@ if strstr "$(cat /proc/mounts)" "/oldroot"; then
         case $_pid in
             *[!0-9]*) continue;;
         esac
-        [ -e /proc/$_pid/exe ] || continue
-        [ -e /proc/$_pid/root ] || continue
+        [ $_pid -eq $$ ] && continue
+
+        [ -e "/proc/$_pid/exe" ] || continue
+        [ -e "/proc/$_pid/root" ] || continue
+
         if strstr "$(ls -l /proc/$_pid /proc/$_pid/fd 2>/dev/null)" "oldroot"; then
             warn "Blocking umount of /oldroot [$_pid] $(cat /proc/$_pid/cmdline)"
-        elif [ $_pid -ne $$ ]; then
+        else
             warn "Still running [$_pid] $(cat /proc/$_pid/cmdline)"
         fi
-        ls -l /proc/$_pid/fd 2>&1 | vwarn
+
+        ls -l "/proc/$_pid/exe" 2>&1 | vwarn
+        ls -l "/proc/$_pid/fd" 2>&1 | vwarn
     done
 fi