Blame SOURCES/0161-fstab-do-not-mount-and-fsck-from-fstab-if-using-syst.patch

18971c
From f077a200564b7197048003685a153aa1b2b3e306 Mon Sep 17 00:00:00 2001
18971c
From: WANG Chao <chaowang@redhat.com>
18971c
Date: Tue, 1 Apr 2014 15:20:49 +0800
18971c
Subject: [PATCH] fstab: do not mount and fsck from fstab if using systemd
18971c
18971c
If using systemd in initramfs, we could run into a race condition when
18971c
dracut and systemd both are trying to mount and run fsck for the same
18971c
filesystem, and mount or fsck could be a failure.
18971c
18971c
To fix such failure, we should use systemd to mount/fsck from /etc/fstab
18971c
only.
18971c
18971c
v2: check $DRACUT_SYSTEMD suggested by Alexander Tsoy
18971c
18971c
Signed-off-by: WANG Chao <chaowang@redhat.com>
18971c
(cherry picked from commit e920bfb1e8a5917e7b0f360d1c51d200db3acbfd)
18971c
---
18971c
 modules.d/95fstab-sys/mount-sys.sh | 6 +++++-
18971c
 1 file changed, 5 insertions(+), 1 deletion(-)
18971c
18971c
diff --git a/modules.d/95fstab-sys/mount-sys.sh b/modules.d/95fstab-sys/mount-sys.sh
18971c
index 12711a07..a2378101 100755
18971c
--- a/modules.d/95fstab-sys/mount-sys.sh
18971c
+++ b/modules.d/95fstab-sys/mount-sys.sh
18971c
@@ -27,7 +27,11 @@ fstab_mount() {
18971c
     return 0
18971c
 }
18971c
 
18971c
-[ -f /etc/fstab ] && fstab_mount /etc/fstab
18971c
+# systemd will mount and run fsck from /etc/fstab and we don't want to
18971c
+# run into a race condition.
18971c
+if [ -z "$DRACUT_SYSTEMD" ]; then
18971c
+    [ -f /etc/fstab ] && fstab_mount /etc/fstab
18971c
+fi
18971c
 
18971c
 # prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
18971c
 if [ -f $NEWROOT/etc/fstab.sys ]; then