summaryrefslogtreecommitdiffstats
path: root/abs/core/lvm2/lvm2_hook
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/lvm2/lvm2_hook')
-rw-r--r--abs/core/lvm2/lvm2_hook13
1 files changed, 13 insertions, 0 deletions
diff --git a/abs/core/lvm2/lvm2_hook b/abs/core/lvm2/lvm2_hook
index 65de7bd..3c28d67 100644
--- a/abs/core/lvm2/lvm2_hook
+++ b/abs/core/lvm2/lvm2_hook
@@ -5,6 +5,19 @@ run_earlyhook() {
lvmetad
}
+# We are suffering a race condition in non-systemd initramfs: If lvmetad is
+# killed before pvscan processes finish we have stale processes and
+# uninitialized physical volumes. So wait for pvscan processes to finish.
+# Break after 10 seconds (50*0.2s) to avaid infinite loop.
+run_latehook() {
+ local i=50
+
+ while pgrep -f pvscan >/dev/null 2>/dev/null && [ $i -gt 0 ]; do
+ sleep 0.2
+ i=$((i - 1))
+ done
+}
+
run_cleanuphook() {
kill $(cat /run/lvmetad.pid)
}