summaryrefslogtreecommitdiffstats
path: root/0009-fstab-do-not-mount-and-fsck-from-fstab-if-using-syst.patch
blob: 37042595fbf6a5af50f9e6cbac44d6135dca5011 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From e920bfb1e8a5917e7b0f360d1c51d200db3acbfd Mon Sep 17 00:00:00 2001
From: WANG Chao <chaowang@redhat.com>
Date: Tue, 1 Apr 2014 15:20:49 +0800
Subject: [PATCH] fstab: do not mount and fsck from fstab if using systemd

If using systemd in initramfs, we could run into a race condition when
dracut and systemd both are trying to mount and run fsck for the same
filesystem, and mount or fsck could be a failure.

To fix such failure, we should use systemd to mount/fsck from /etc/fstab
only.

v2: check $DRACUT_SYSTEMD suggested by Alexander Tsoy

Signed-off-by: WANG Chao <chaowang@redhat.com>
---
 modules.d/95fstab-sys/mount-sys.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules.d/95fstab-sys/mount-sys.sh b/modules.d/95fstab-sys/mount-sys.sh
index 12711a0..a237810 100755
--- a/modules.d/95fstab-sys/mount-sys.sh
+++ b/modules.d/95fstab-sys/mount-sys.sh
@@ -27,7 +27,11 @@ fstab_mount() {
     return 0
 }
 
-[ -f /etc/fstab ] && fstab_mount /etc/fstab
+# systemd will mount and run fsck from /etc/fstab and we don't want to
+# run into a race condition.
+if [ -z "$DRACUT_SYSTEMD" ]; then
+    [ -f /etc/fstab ] && fstab_mount /etc/fstab
+fi
 
 # prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
 if [ -f $NEWROOT/etc/fstab.sys ]; then