-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0031.patch
More file actions
71 lines (64 loc) · 2.37 KB
/
0031.patch
File metadata and controls
71 lines (64 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From df6bb5e959178cba06118493a7c8d019e84d54e7 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 15 May 2018 13:37:53 +0200
Subject: [PATCH] shutdown: sleep a little, if a process was killed
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.
---
modules.d/99base/dracut-lib.sh | 7 ++++++-
modules.d/99shutdown/module-setup.sh | 2 +-
modules.d/99shutdown/shutdown.sh | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 99cb9dbc..b78272a3 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -118,6 +118,7 @@ str_replace() {
killall_proc_mountpoint() {
local _pid
local _t
+ local _killed=0
for _pid in /proc/*; do
_pid=${_pid##/proc/}
case $_pid in
@@ -125,8 +126,12 @@ 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"
+ if strstr "$(ls -l -- "/proc/$_pid" "/proc/$_pid/fd" 2>/dev/null)" "$1" ; then
+ kill -9 "$_pid"
+ _killed=1
+ fi
done
+ return $_killed
}
getcmdline() {
diff --git a/modules.d/99shutdown/module-setup.sh b/modules.d/99shutdown/module-setup.sh
index 5cb3594a..dfd6caa2 100755
--- a/modules.d/99shutdown/module-setup.sh
+++ b/modules.d/99shutdown/module-setup.sh
@@ -14,7 +14,7 @@ depends() {
# 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
diff --git a/modules.d/99shutdown/shutdown.sh b/modules.d/99shutdown/shutdown.sh
index 918a8a4f..f21cc811 100755
--- a/modules.d/99shutdown/shutdown.sh
+++ b/modules.d/99shutdown/shutdown.sh
@@ -38,7 +38,7 @@ source_hook pre-shutdown
warn "Killing all remaining processes"
-killall_proc_mountpoint /oldroot
+killall_proc_mountpoint /oldroot || sleep 0.2
umount_a() {
local _did_umount="n"