If a process (maybe plymouth) was still pinning /oldroot, then shutdown
would
- kill -9 $pid
- umount_a
- umount_a
in a very short timeframe. A small sleep hopefully lets the scheduler free
up /oldroot in the mean time.
killall_proc_mountpoint() {
local _pid
local _t
+ local _killed=0
for _pid in /proc/*; do
_pid=${_pid##/proc/}
case $_pid in
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"
+ if strstr "$(ls -l -- "/proc/$_pid" "/proc/$_pid/fd" 2>/dev/null)" "$1" ; then
+ kill -9 "$_pid"
+ _killed=1
+ fi
done
+ return $_killed
}
getcmdline() {
# called by dracut
install() {
local _d
- inst_multiple umount poweroff reboot halt losetup stat
+ inst_multiple umount poweroff reboot halt losetup stat sleep
inst_multiple -o kexec
inst "$moddir/shutdown.sh" "$prefix/shutdown"
[ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib
warn "Killing all remaining processes"
-killall_proc_mountpoint /oldroot
+killall_proc_mountpoint /oldroot || sleep 0.2
umount_a() {
local _did_umount="n"