* [PATCH] Order root fsck after dracut-pre-mount.service
@ 2014-11-22 16:43 Andrei Borzenkov
0 siblings, 0 replies; only message in thread
From: Andrei Borzenkov @ 2014-11-22 16:43 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
Currently root fsck runs concurrently with dracut-pre-mount and so
races with resume from disk (started by dracut-pre-mount). This leads
to data corruption if fsck changes filesystem.
Make sure root fsck runs after dracut-pre-mount.service.
Details including console logs:
https://bugzilla.suse.com/show_bug.cgi?id=906592
Signed-off-by: Andrei Borzenkov <arvidjaar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
modules.d/98systemd/rootfs-generator.sh | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/modules.d/98systemd/rootfs-generator.sh b/modules.d/98systemd/rootfs-generator.sh
index 9523729..a2d26b9 100755
--- a/modules.d/98systemd/rootfs-generator.sh
+++ b/modules.d/98systemd/rootfs-generator.sh
@@ -32,6 +32,22 @@ generator_wait_for_dev()
fi
}
+generator_fsck_after_pre_mount()
+{
+ local _name
+
+ [ -z "$1" ] && return 0
+
+ _name=$(dev_unit_name "$1")
+ [ -d /run/systemd/generator/systemd-fsck@${_name}.service.d ] || mkdir -p /run/systemd/generator/systemd-fsck@${_name}.service.d
+ if ! [ -f /run/systemd/generator/systemd-fsck@${_name}.service.d/after-pre-mount.conf ]; then
+ {
+ echo "[Unit]"
+ echo "After=dracut-pre-mount.service"
+ } > /run/systemd/generator/systemd-fsck@${_name}.service.d/after-pre-mount.conf
+ fi
+}
+
root=$(getarg root=)
case "$root" in
block:LABEL=*|LABEL=*)
@@ -58,6 +74,9 @@ case "$root" in
rootok=1 ;;
esac
-[ "${root%%:*}" = "block" ] && generator_wait_for_dev "${root#block:}"
+if [ "${root%%:*}" = "block" ]; then
+ generator_wait_for_dev "${root#block:}"
+ generator_fsck_after_pre_mount "${root#block:}"
+fi
exit 0
--
tg: (778b354..) u/root-fsck-after-pre-mount (depends on: master)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-11-22 16:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-22 16:43 [PATCH] Order root fsck after dracut-pre-mount.service Andrei Borzenkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox