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