anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0221-fstab-generator-Generate-explicit-dependencies-on-sy.patch

572a44
From 8a9eab141ab379c658fc198fb0b0ee4ca3bdd1d2 Mon Sep 17 00:00:00 2001
572a44
From: =?UTF-8?q?Thomas=20B=C3=A4chler?= <thomas@archlinux.org>
572a44
Date: Mon, 30 Sep 2013 01:34:44 +0200
572a44
Subject: [PATCH] fstab-generator: Generate explicit dependencies on
572a44
 systemd-fsck@.service instead of using FsckPassNo
572a44
572a44
[tomegun:
572a44
  * order all fsck instances after fsck-root
572a44
  * check for OOM
572a44
  * added notes in the manpages]
572a44
572a44
Conflicts:
572a44
	man/systemd-fsck@.service.xml
572a44
	man/systemd-fstab-generator.xml
572a44
---
572a44
 man/systemd-fsck@.service.xml         |  4 +---
572a44
 man/systemd-fstab-generator.xml       |  9 ++++-----
572a44
 src/fstab-generator/fstab-generator.c | 21 +++++++++++++++++----
572a44
 units/systemd-fsck@.service.in        |  2 +-
572a44
 4 files changed, 23 insertions(+), 13 deletions(-)
572a44
572a44
diff --git a/man/systemd-fsck@.service.xml b/man/systemd-fsck@.service.xml
572a44
index c653dc5..17bd1c0 100644
572a44
--- a/man/systemd-fsck@.service.xml
572a44
+++ b/man/systemd-fsck@.service.xml
572a44
@@ -63,9 +63,7 @@
572a44
                 check. <filename>systemd-fsck-root.service</filename> is
572a44
                 responsible for file system checks on the root
572a44
                 file system. The root file system check is performed
572a44
-                before the other file systems. Either service is enabled
572a44
-                at boot if passno in <filename>/etc/fstab</filename> for
572a44
-                the file system is set to a value greater than zero.</para>
572a44
+                before the other file systems.</para>
572a44
 
572a44
                 <para><filename>systemd-fsck</filename> will
572a44
                 forward file system checking progress to the
572a44
diff --git a/man/systemd-fstab-generator.xml b/man/systemd-fstab-generator.xml
572a44
index e3cf5d2..740db8f 100644
572a44
--- a/man/systemd-fstab-generator.xml
572a44
+++ b/man/systemd-fstab-generator.xml
572a44
@@ -61,11 +61,10 @@
572a44
                 reloaded. This will instantiate mount and swap units
572a44
                 as necessary.</para>
572a44
 
572a44
-                <para>The <varname>passno</varname> field is treated
572a44
-                like a simple boolean, and the ordering information is
572a44
-                discarded. However, if the root file system is
572a44
-                checked, it is checked before all the other
572a44
-                file systems.</para>
572a44
+                <para>The <term><varname>passno</varname></term> field
572a44
+                is treated like a simlpe boolean, and the ordering information
572a44
+                is discarded. However, the root filesystem is checked
572a44
+                before all the other filesystems.</para>
572a44
 
572a44
                 <para>See
572a44
                 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
572a44
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
572a44
index 6cecb4e..7874ff1 100644
572a44
--- a/src/fstab-generator/fstab-generator.c
572a44
+++ b/src/fstab-generator/fstab-generator.c
572a44
@@ -209,17 +209,30 @@ static int add_mount(
572a44
                         "Before=%s\n",
572a44
                         post);
572a44
 
572a44
+        if (passno > 0) {
572a44
+                _cleanup_free_ char *fsck = NULL;
572a44
+
572a44
+                fsck = unit_name_from_path_instance("systemd-fsck", what, ".service");
572a44
+                if (!fsck)
572a44
+                        return log_oom();
572a44
+
572a44
+                fprintf(f,
572a44
+                        "Requires=%s\n"
572a44
+                        "After=%s\n",
572a44
+                        fsck,
572a44
+                        fsck);
572a44
+        }
572a44
+
572a44
+
572a44
         fprintf(f,
572a44
                 "\n"
572a44
                 "[Mount]\n"
572a44
                 "What=%s\n"
572a44
                 "Where=%s\n"
572a44
-                "Type=%s\n"
572a44
-                "FsckPassNo=%i\n",
572a44
+                "Type=%s\n",
572a44
                 what,
572a44
                 where,
572a44
-                type,
572a44
-                passno);
572a44
+                type);
572a44
 
572a44
         if (!isempty(opts) &&
572a44
             !streq(opts, "defaults"))
572a44
diff --git a/units/systemd-fsck@.service.in b/units/systemd-fsck@.service.in
572a44
index e229cdc..c12efa8 100644
572a44
--- a/units/systemd-fsck@.service.in
572a44
+++ b/units/systemd-fsck@.service.in
572a44
@@ -10,7 +10,7 @@ Description=File System Check on %f
572a44
 Documentation=man:systemd-fsck@.service(8)
572a44
 DefaultDependencies=no
572a44
 BindsTo=%i.device
572a44
-After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device
572a44
+After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device systemd-fsck-root.service
572a44
 Before=shutdown.target
572a44
 
572a44
 [Service]