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

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