File 0165-Order-root-fsck-after-pre-mount.patch of Package dracut.892

From 3d87bee0bcb81c5bd35b472a1912a95d2cc4dfd2 Mon Sep 17 00:00:00 2001
From: Andrei Borzenkov <arvidjaar@gmail.com>
Date: Fri, 6 Feb 2015 13:10:49 +0100
Subject: Order root fsck after pre-mount

This ensure pre-mount (and resume) is run before root fsck.

References: bnc#906592

Signed-off-by: Andrei Borzenkov <arvidjaar@gmail.com>
---
 modules.d/98systemd/rootfs-generator.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/modules.d/98systemd/rootfs-generator.sh b/modules.d/98systemd/rootfs-generator.sh
index 13428da..8473784 100755
--- a/modules.d/98systemd/rootfs-generator.sh
+++ b/modules.d/98systemd/rootfs-generator.sh
@@ -66,6 +66,23 @@ generator_mount_rootfs()
     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=*)
@@ -94,6 +111,7 @@ esac
 
 if [ "${root%%:*}" = "block" ]; then
    generator_wait_for_dev "${root#block:}" "$RDRETRY"
+   generator_fsck_after_pre_mount "${root#block:}"
    grep -q 'root=' /proc/cmdline || generator_mount_rootfs "${root#block:}" "$(getarg rootfstype=)" "$(getarg rootflags=)"
 fi
 
-- 
1.8.4.5