[systemd-commits] 9 commits - Makefile.am man/systemd-fsck at .service.xml man/systemd-fstab-generator.xml man/systemd.mount.xml man/systemd.service.xml src/core src/efi-boot-generator src/fstab-generator src/gpt-auto-generator src/udev TODO units/systemd-fsck-root.service.in units/systemd-fsck at .service.in
Tom Gundersen
tomegun at kemper.freedesktop.org
Sat Oct 19 03:24:14 PDT 2013
Makefile.am | 1
TODO | 10 -----
man/systemd-fsck at .service.xml | 5 ++
man/systemd-fstab-generator.xml | 5 ++
man/systemd.mount.xml | 22 ------------
man/systemd.service.xml | 27 --------------
src/core/load-fragment-gperf.gperf.m4 | 2 -
src/core/load-fragment.c | 30 ----------------
src/core/load-fragment.h | 1
src/core/mount.c | 32 -----------------
src/core/mount.h | 1
src/core/service.c | 51 ----------------------------
src/core/service.h | 2 -
src/efi-boot-generator/efi-boot-generator.c | 26 ++++++++++++--
src/fstab-generator/fstab-generator.c | 36 +++++++++++++++++--
src/gpt-auto-generator/gpt-auto-generator.c | 14 ++++---
src/udev/udev-builtin-uaccess.c | 4 --
units/systemd-fsck-root.service.in | 1
units/systemd-fsck at .service.in | 2 -
19 files changed, 73 insertions(+), 199 deletions(-)
New commits:
commit 182ae347697e9511294ec49009bcd208cce1ee4c
Author: Tom Gundersen <teg at jklm.no>
Date: Sat Oct 19 12:23:41 2013 +0200
TODO: update
diff --git a/TODO b/TODO
index 814d82d..c140098 100644
--- a/TODO
+++ b/TODO
@@ -714,11 +714,6 @@ Features:
* systemd-run is missing zsh completion scripts
-* fsck:
- - always fsck the rootfs before mounting from the initrd
- - by default do not fsck the rootfs in the real root, unless passno > 0 in fstab
- - rip out all fsckpassno handling from the core and treat it as a bolean in the fstab generator
-
External:
* dbus:
commit 06f06393313e125123ea50ac79fef10e5e7ecef1
Author: Tom Gundersen <teg at jklm.no>
Date: Sat Oct 19 12:13:25 2013 +0200
udev-builtin: uaccess - inherit logging form udev
Not that it makes a difference in this builtin, but otherwise /etc/udev/udev.conf is not respected.
diff --git a/src/udev/udev-builtin-uaccess.c b/src/udev/udev-builtin-uaccess.c
index 354ee08..ddb0157 100644
--- a/src/udev/udev-builtin-uaccess.c
+++ b/src/udev/udev-builtin-uaccess.c
@@ -41,10 +41,6 @@ static int builtin_uaccess(struct udev_device *dev, int argc, char *argv[], bool
bool changed_acl = false;
uid_t uid;
- log_set_target(LOG_TARGET_AUTO);
- log_parse_environment();
- log_open();
-
umask(0022);
/* don't muck around with ACLs when the system is not running systemd */
commit a7623afb7a48ab1d7b5b24fbd5f1033acfb2301c
Author: Tom Gundersen <teg at jklm.no>
Date: Sat Oct 19 11:38:42 2013 +0200
fsck-root: only run when requested in fstab
fsck-root is redundant in case an initrd is used, or in case the rootfs
is never remounted 'rw', so the new default is the correct behavior for
most users. For the rest, they should enable it in fstab.
diff --git a/Makefile.am b/Makefile.am
index ca01179..a29a32a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4447,7 +4447,6 @@ SYSINIT_TARGET_WANTS += \
systemd-update-utmp.service
LOCAL_FS_TARGET_WANTS += \
systemd-remount-fs.service \
- systemd-fsck-root.service \
tmp.mount
MULTI_USER_TARGET_WANTS += \
getty.target \
diff --git a/man/systemd-fsck at .service.xml b/man/systemd-fsck at .service.xml
index 17bd1c0..811392b 100644
--- a/man/systemd-fsck at .service.xml
+++ b/man/systemd-fsck at .service.xml
@@ -63,7 +63,9 @@
check. <filename>systemd-fsck-root.service</filename> is
responsible for file system checks on the root
file system. The root file system check is performed
- before the other file systems.</para>
+ before the other file systems. Either service is enabled
+ at boot if passno in <filename>/etc/fstab</filename> for
+ the filesystem is set to a value greater than zero.</para>
<para><filename>systemd-fsck</filename> will
forward file system checking progress to the
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 77247de..78d7609 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -210,17 +210,29 @@ static int add_mount(
post);
if (passno > 0) {
- _cleanup_free_ char *fsck = NULL;
+ if (streq(where, "/")) {
+ lnk = strjoin(arg_dest, "/", SPECIAL_LOCAL_FS_TARGET, ".wants/", "systemd-fsck-root.service", NULL);
+ if (!lnk)
+ return log_oom();
- fsck = unit_name_from_path_instance("systemd-fsck", what, ".service");
- if (!fsck)
- return log_oom();
+ mkdir_parents_label(lnk, 0755);
+ if (symlink("systemd-fsck-root.service", lnk) < 0) {
+ log_error("Failed to create symlink %s: %m", lnk);
+ return -errno;
+ }
+ } else {
+ _cleanup_free_ char *fsck = NULL;
- fprintf(f,
- "Requires=%s\n"
- "After=%s\n",
- fsck,
- fsck);
+ fsck = unit_name_from_path_instance("systemd-fsck", what, ".service");
+ if (!fsck)
+ return log_oom();
+
+ fprintf(f,
+ "Requires=%s\n"
+ "After=%s\n",
+ fsck,
+ fsck);
+ }
}
@@ -248,6 +260,7 @@ static int add_mount(
if (!noauto) {
if (post) {
+ free(lnk);
lnk = strjoin(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL);
if (!lnk)
return log_oom();
commit d09ee17da21b7ca2259067ac4e54f8a1cc3c0fc0
Author: Tom Gundersen <teg at jklm.no>
Date: Sat Oct 5 17:32:21 2013 +0200
efi-boot-generator: hookup to fsck
diff --git a/TODO b/TODO
index f0060d9..814d82d 100644
--- a/TODO
+++ b/TODO
@@ -308,7 +308,6 @@ Features:
* introduce ExecCondition= in services
* EFI:
- - fsck hookup for the ESP mount is missing
- write man page for efi boot generator
- honor language efi variables for default language selection (if there are any?)
- honor timezone efi variables for default timezone selection (if there are any?)
diff --git a/src/efi-boot-generator/efi-boot-generator.c b/src/efi-boot-generator/efi-boot-generator.c
index 05b95ed..e20d325 100644
--- a/src/efi-boot-generator/efi-boot-generator.c
+++ b/src/efi-boot-generator/efi-boot-generator.c
@@ -26,13 +26,14 @@
#include "path-util.h"
#include "util.h"
#include "mkdir.h"
+#include "unit-name.h"
static const char *arg_dest = "/tmp";
int main(int argc, char *argv[]) {
int r = EXIT_SUCCESS;
sd_id128_t id;
- _cleanup_free_ char *name = NULL;
+ _cleanup_free_ char *name = NULL, *what = NULL, *fsck = NULL;
_cleanup_fclose_ FILE *f = NULL;
if (argc > 1 && argc != 4) {
@@ -75,15 +76,32 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
+ r = asprintf(&what,
+ "/dev/disk/by-partuuid/%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ SD_ID128_FORMAT_VAL(id));
+ if (r < 0) {
+ log_oom();
+ return EXIT_FAILURE;
+ }
+
+ fsck = unit_name_from_path_instance("systemd-fsck", what, ".service");
+ if (!fsck) {
+ log_oom();
+ return EXIT_FAILURE;
+ }
+
fprintf(f,
"# Automatially generated by systemd-efi-boot-generator\n\n"
"[Unit]\n"
- "Description=EFI System Partition\n\n"
+ "Description=EFI System Partition\n"
+ "Requires=%s\n"
+ "After=%s\n"
+ "\n"
"[Mount]\n"
"Where=/boot\n"
- "What=/dev/disk/by-partuuid/%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n"
+ "What=%s\n"
"Options=umask=0077\n",
- SD_ID128_FORMAT_VAL(id));
+ fsck, fsck, what);
free(name);
name = strjoin(arg_dest, "/boot.automount", NULL);
commit accdd018ede77ef1c057775396c18c73406cbcb4
Author: Tom Gundersen <teg at jklm.no>
Date: Sat Oct 5 17:28:09 2013 +0200
mount/service: drop FsckPassNo support
We now treat passno as boleans in the generators, and don't need this any more. fsck itself
is able to sequentialize checks on the same local media, so in the common case the ordering
is redundant.
It is still possible to force an order by using .d fragments, in case that is desired.
diff --git a/TODO b/TODO
index 29a76ef..f0060d9 100644
--- a/TODO
+++ b/TODO
@@ -84,8 +84,6 @@ Features:
* ensure scope units may be started only a single time
-* document that in instead of FsckPassNo= people should just add a manual dep to systemd-fsck at .service to their mount units.
-
* better error message if you run systemctl without systemd running
* systemctl status output should should include list of triggering units and their status
@@ -562,8 +560,6 @@ Features:
* when breaking cycles drop sysv services first, then services from /run, then from /etc, then from /usr
-* move passno parsing to fstab generator
-
* automount: implement expire:
- set superblock timeout AUTOFS_DEV_IOCTL_TIMEOUT_CMD
- periodically run AUTOFS_DEV_IOCTL_EXPIRE_CMD
diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml
index 48af1ca..217289a 100644
--- a/man/systemd.mount.xml
+++ b/man/systemd.mount.xml
@@ -273,28 +273,6 @@
</refsect1>
<refsect1>
- <title>Compatibility Options</title>
-
- <para>The following option is also available in the
- <literal>[Mount]</literal> section, but exists purely
- for compatibility reasons and should not be used in
- newly written mount files.</para>
-
- <variablelist class='unit-directives'>
- <varlistentry>
- <term><varname>FsckPassNo=</varname></term>
-
- <listitem><para>The pass number for
- the file system checking service for
- this mount. See
- <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
- for more information on this setting.
- </para></listitem>
- </varlistentry>
- </variablelist>
- </refsect1>
-
- <refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index 81a4078..b1e3af2 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -970,33 +970,6 @@
range 0-99.</para></listitem>
</varlistentry>
- <varlistentry>
- <term><varname>FsckPassNo=</varname></term>
- <listitem><para>Set the fsck passno
- priority to use to order this service
- in relation to other file system
- checking services. This option is only
- necessary to fix ordering in relation
- to fsck jobs automatically created for
- all <filename>/etc/fstab</filename>
- entries with a value in the fs_passno
- column > 0. As such it should only be
- used as option for fsck
- services. Almost always it is a better
- choice to add explicit ordering
- directives via
- <varname>After=</varname> or
- <varname>Before=</varname>,
- instead. For more details see
- <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If
- used, pass an integer value in the
- same range as
- <filename>/etc/fstab</filename>'s
- fs_passno column. See
- <citerefentry><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
- for details.</para></listitem>
- </varlistentry>
-
</variablelist>
</refsect1>
diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4
index 31fb7bc..e3025d2 100644
--- a/src/core/load-fragment-gperf.gperf.m4
+++ b/src/core/load-fragment-gperf.gperf.m4
@@ -173,7 +173,6 @@ Service.NonBlocking, config_parse_bool, 0,
Service.BusName, config_parse_unit_string_printf, 0, offsetof(Service, bus_name)
Service.NotifyAccess, config_parse_notify_access, 0, offsetof(Service, notify_access)
Service.Sockets, config_parse_service_sockets, 0, 0
-Service.FsckPassNo, config_parse_fsck_passno, 0, offsetof(Service, fsck_passno)
EXEC_CONTEXT_CONFIG_ITEMS(Service)m4_dnl
CGROUP_CONTEXT_CONFIG_ITEMS(Service)m4_dnl
KILL_CONTEXT_CONFIG_ITEMS(Service)m4_dnl
@@ -225,7 +224,6 @@ Mount.What, config_parse_string, 0,
Mount.Where, config_parse_path, 0, offsetof(Mount, where)
Mount.Options, config_parse_string, 0, offsetof(Mount, parameters_fragment.options)
Mount.Type, config_parse_string, 0, offsetof(Mount, parameters_fragment.fstype)
-Mount.FsckPassNo, config_parse_fsck_passno, 0, offsetof(Mount, parameters_fragment.passno)
Mount.TimeoutSec, config_parse_sec, 0, offsetof(Mount, timeout_usec)
Mount.DirectoryMode, config_parse_mode, 0, offsetof(Mount, directory_mode)
EXEC_CONTEXT_CONFIG_ITEMS(Mount)m4_dnl
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index fb7efca..4067930 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -1033,35 +1033,6 @@ int config_parse_sysv_priority(const char *unit,
}
#endif
-int config_parse_fsck_passno(const char *unit,
- const char *filename,
- unsigned line,
- const char *section,
- const char *lvalue,
- int ltype,
- const char *rvalue,
- void *data,
- void *userdata) {
-
- int *passno = data;
- int i, r;
-
- assert(filename);
- assert(lvalue);
- assert(rvalue);
- assert(data);
-
- r = safe_atoi(rvalue, &i);
- if (r || i < 0) {
- log_syntax(unit, LOG_ERR, filename, line, -r,
- "Failed to parse fsck pass number, ignoring: %s", rvalue);
- return 0;
- }
-
- *passno = (int) i;
- return 0;
-}
-
DEFINE_CONFIG_PARSE_ENUM(config_parse_kill_mode, kill_mode, KillMode, "Failed to parse kill mode");
int config_parse_kill_signal(const char *unit,
@@ -2708,7 +2679,6 @@ void unit_dump_config_items(FILE *f) {
{ config_parse_start_limit_action, "ACTION" },
{ config_parse_set_status, "STATUS" },
{ config_parse_service_sockets, "SOCKETS" },
- { config_parse_fsck_passno, "PASSNO" },
{ config_parse_environ, "ENVIRON" },
{ config_parse_syscall_filter, "SYSCALL" },
{ config_parse_cpu_shares, "SHARES" },
diff --git a/src/core/load-fragment.h b/src/core/load-fragment.h
index 90e5e3a..404df76 100644
--- a/src/core/load-fragment.h
+++ b/src/core/load-fragment.h
@@ -56,7 +56,6 @@ int config_parse_exec_secure_bits(const char *unit, const char *filename, unsign
int config_parse_bounding_set(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_limit(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_sysv_priority(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_fsck_passno(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_kill_signal(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_exec_mount_flags(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_timer(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
diff --git a/src/core/mount.c b/src/core/mount.c
index 70cd372..88563b3 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -313,33 +313,6 @@ static int mount_add_device_links(Mount *m) {
if (r < 0)
return r;
- if (p->passno > 0 &&
- UNIT(m)->manager->running_as == SYSTEMD_SYSTEM) {
- char *name;
- Unit *fsck;
- /* Let's add in the fsck service */
-
- /* aka SPECIAL_FSCK_SERVICE */
- name = unit_name_from_path_instance("systemd-fsck", p->what, ".service");
- if (!name)
- return -ENOMEM;
-
- r = manager_load_unit_prepare(UNIT(m)->manager, name, NULL, NULL, &fsck);
- if (r < 0) {
- log_warning_unit(name,
- "Failed to prepare unit %s: %s", name, strerror(-r));
- free(name);
- return r;
- }
- free(name);
-
- SERVICE(fsck)->fsck_passno = p->passno;
-
- r = unit_add_two_dependencies(UNIT(m), UNIT_AFTER, UNIT_REQUIRES, fsck, true);
- if (r < 0)
- return r;
- }
-
return 0;
}
@@ -1410,7 +1383,6 @@ static int mount_add_one(
const char *where,
const char *options,
const char *fstype,
- int passno,
bool set_flags) {
int r;
Unit *u;
@@ -1530,8 +1502,6 @@ static int mount_add_one(
free(p->fstype);
p->fstype = f;
- p->passno = passno;
-
if (load_extras) {
r = mount_add_extras(MOUNT(u));
if (r < 0)
@@ -1601,7 +1571,7 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
if (!d || !p)
return log_oom();
- k = mount_add_one(m, d, p, o, fstype, 0, set_flags);
+ k = mount_add_one(m, d, p, o, fstype, set_flags);
if (k < 0)
r = k;
}
diff --git a/src/core/mount.h b/src/core/mount.h
index 7cd4320..a955069 100644
--- a/src/core/mount.h
+++ b/src/core/mount.h
@@ -58,7 +58,6 @@ typedef struct MountParameters {
char *what;
char *options;
char *fstype;
- int passno;
} MountParameters;
typedef enum MountResult {
diff --git a/src/core/service.c b/src/core/service.c
index 96ed2d3..ce75757 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1056,48 +1056,6 @@ static int service_load_sysv(Service *s) {
}
#endif
-static int fsck_fix_order(Service *s) {
- Unit *other;
- int r;
-
- assert(s);
-
- if (s->fsck_passno <= 0)
- return 0;
-
- /* For each pair of services where both have an fsck priority
- * we order things based on it. */
-
- LIST_FOREACH(units_by_type, other, UNIT(s)->manager->units_by_type[UNIT_SERVICE]) {
- Service *t;
- UnitDependency d;
-
- t = SERVICE(other);
-
- if (s == t)
- continue;
-
- if (UNIT(t)->load_state != UNIT_LOADED)
- continue;
-
- if (t->fsck_passno <= 0)
- continue;
-
- if (t->fsck_passno < s->fsck_passno)
- d = UNIT_AFTER;
- else if (t->fsck_passno > s->fsck_passno)
- d = UNIT_BEFORE;
- else
- continue;
-
- r = unit_add_dependency(UNIT(s), d, UNIT(t), true);
- if (r < 0)
- return r;
- }
-
- return 0;
-}
-
static int service_verify(Service *s) {
assert(s);
@@ -1254,10 +1212,6 @@ static int service_load(Unit *u) {
return r;
#endif
- r = fsck_fix_order(s);
- if (r < 0)
- return r;
-
if (s->bus_name)
if ((r = unit_watch_bus_name(u, s->bus_name)) < 0)
return r;
@@ -1381,11 +1335,6 @@ static void service_dump(Unit *u, FILE *f, const char *prefix) {
prefix, s->sysv_runlevels);
#endif
- if (s->fsck_passno > 0)
- fprintf(f,
- "%sFsckPassNo: %i\n",
- prefix, s->fsck_passno);
-
if (s->status_text)
fprintf(f, "%sStatus Text: %s\n",
prefix, s->status_text);
diff --git a/src/core/service.h b/src/core/service.h
index ce5b5e0..37fa6ff 100644
--- a/src/core/service.h
+++ b/src/core/service.h
@@ -157,8 +157,6 @@ struct Service {
pid_t main_pid, control_pid;
int socket_fd;
- int fsck_passno;
-
bool permissions_start_only;
bool root_directory_start_only;
bool remain_after_exit;
commit 4952a9beff339b75641a7a84c226c11d6bd680c4
Author: Thomas Bächler <thomas at archlinux.org>
Date: Mon Sep 30 01:34:46 2013 +0200
Remove FsckPassNo from systemd-fsck-root.service
diff --git a/units/systemd-fsck-root.service.in b/units/systemd-fsck-root.service.in
index 4388314..4162983 100644
--- a/units/systemd-fsck-root.service.in
+++ b/units/systemd-fsck-root.service.in
@@ -19,5 +19,4 @@ Type=oneshot
RemainAfterExit=yes
ExecStart=@rootlibexecdir@/systemd-fsck
StandardOutput=journal+console
-FsckPassNo=1
TimeoutSec=0
commit 4c8bda2442bfc6d84a5deb241dc29efcb81bf3af
Author: Thomas Bächler <thomas at archlinux.org>
Date: Mon Sep 30 01:34:45 2013 +0200
gpt-auto-generator: Generate explicit dependencies on systemd-fsck at .service instead of using FsckPassNo
[tomegun: check for OOM]
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index fae4b71..25440e7 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -182,7 +182,7 @@ static int add_swap(const char *path, const char *fstype) {
}
static int add_home(const char *path, const char *fstype) {
- _cleanup_free_ char *unit = NULL, *lnk = NULL;
+ _cleanup_free_ char *unit = NULL, *lnk = NULL, *fsck = NULL;
_cleanup_fclose_ FILE *f = NULL;
if (dir_is_empty("/home") <= 0)
@@ -200,19 +200,23 @@ static int add_home(const char *path, const char *fstype) {
return -errno;
}
+ fsck = unit_name_from_path_instance("systemd-fsck", path, ".service");
+ if (!fsck)
+ return log_oom();
+
fprintf(f,
"# Automatically generated by systemd-gpt-auto-generator\n\n"
"[Unit]\n"
"DefaultDependencies=no\n"
- "After=" SPECIAL_LOCAL_FS_PRE_TARGET "\n"
+ "Requires=%s\n"
+ "After=" SPECIAL_LOCAL_FS_PRE_TARGET " %s\n"
"Conflicts=" SPECIAL_UMOUNT_TARGET "\n"
"Before=" SPECIAL_UMOUNT_TARGET " " SPECIAL_LOCAL_FS_TARGET "\n\n"
"[Mount]\n"
"What=%s\n"
"Where=/home\n"
- "Type=%s\n"
- "FsckPassNo=2\n",
- path, fstype);
+ "Type=%s\n",
+ fsck, fsck, path, fstype);
fflush(f);
if (ferror(f)) {
commit 64e70e4b86d3f732d3513189312f6220d1d5cfbc
Author: Thomas Bächler <thomas at archlinux.org>
Date: Mon Sep 30 01:34:44 2013 +0200
fstab-generator: Generate explicit dependencies on systemd-fsck at .service instead of using FsckPassNo
[tomegun:
* order all fsck instances after fsck-root
* check for OOM
* added notes in the manpages]
diff --git a/man/systemd-fsck at .service.xml b/man/systemd-fsck at .service.xml
index e934352..17bd1c0 100644
--- a/man/systemd-fsck at .service.xml
+++ b/man/systemd-fsck at .service.xml
@@ -62,7 +62,8 @@
system
check. <filename>systemd-fsck-root.service</filename> is
responsible for file system checks on the root
- file system.</para>
+ file system. The root file system check is performed
+ before the other file systems.</para>
<para><filename>systemd-fsck</filename> will
forward file system checking progress to the
diff --git a/man/systemd-fstab-generator.xml b/man/systemd-fstab-generator.xml
index 9ca16c7..740db8f 100644
--- a/man/systemd-fstab-generator.xml
+++ b/man/systemd-fstab-generator.xml
@@ -61,6 +61,11 @@
reloaded. This will instantiate mount and swap units
as necessary.</para>
+ <para>The <term><varname>passno</varname></term> field
+ is treated like a simlpe boolean, and the ordering information
+ is discarded. However, the root filesystem is checked
+ before all the other filesystems.</para>
+
<para>See
<citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
and
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index a7536f8..77247de 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -209,17 +209,30 @@ static int add_mount(
"Before=%s\n",
post);
+ if (passno > 0) {
+ _cleanup_free_ char *fsck = NULL;
+
+ fsck = unit_name_from_path_instance("systemd-fsck", what, ".service");
+ if (!fsck)
+ return log_oom();
+
+ fprintf(f,
+ "Requires=%s\n"
+ "After=%s\n",
+ fsck,
+ fsck);
+ }
+
+
fprintf(f,
"\n"
"[Mount]\n"
"What=%s\n"
"Where=%s\n"
- "Type=%s\n"
- "FsckPassNo=%i\n",
+ "Type=%s\n",
what,
where,
- type,
- passno);
+ type);
if (!isempty(opts) &&
!streq(opts, "defaults"))
diff --git a/units/systemd-fsck at .service.in b/units/systemd-fsck at .service.in
index e229cdc..c12efa8 100644
--- a/units/systemd-fsck at .service.in
+++ b/units/systemd-fsck at .service.in
@@ -10,7 +10,7 @@ Description=File System Check on %f
Documentation=man:systemd-fsck at .service(8)
DefaultDependencies=no
BindsTo=%i.device
-After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device
+After=systemd-readahead-collect.service systemd-readahead-replay.service %i.device systemd-fsck-root.service
Before=shutdown.target
[Service]
commit 7f5806d7095a197e4788a7803642831beec295bf
Author: Thomas Bächler <thomas at archlinux.org>
Date: Mon Sep 30 00:32:33 2013 +0200
fstab-generator: When parsing the root= cmdline option, set FsckPassNo to 1
[tomegun: without this we would never fsck the rootfs if it was directly
mounted 'rw' from the initrd. We now risk fsck'ing it twice in the case it
is mounted 'ro', so that should be addressed in a separate patch.]
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 9e7d55d..a7536f8 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -442,7 +442,7 @@ static int parse_new_root_from_proc_cmdline(void) {
}
log_debug("Found entry what=%s where=/sysroot type=%s", what, type);
- r = add_mount(what, "/sysroot", type, opts, 0, noauto, nofail, false,
+ r = add_mount(what, "/sysroot", type, opts, 1, noauto, nofail, false,
SPECIAL_INITRD_ROOT_FS_TARGET, "/proc/cmdline");
return (r < 0) ? r : 0;
More information about the systemd-commits
mailing list