chiark / gitweb /
mount/service: drop FsckPassNo support
authorTom Gundersen <teg@jklm.no>
Sat, 5 Oct 2013 15:28:09 +0000 (17:28 +0200)
committerTom Gundersen <teg@jklm.no>
Sat, 19 Oct 2013 10:23:17 +0000 (12:23 +0200)
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.

TODO
man/systemd.mount.xml
man/systemd.service.xml
src/core/load-fragment-gperf.gperf.m4
src/core/load-fragment.c
src/core/load-fragment.h
src/core/mount.c
src/core/mount.h
src/core/service.c
src/core/service.h

diff --git a/TODO b/TODO
index 29a76ef5046ebecccb073cd849e62632e4e0ebfa..f0060d957f028246727b346ec896a2efac951ee3 100644 (file)
--- 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@.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
index 48af1caaceaae4385667867f9cc3505856e15575..217289ab75f8a214a9261db359e6e3af4439e70b 100644 (file)
                 for more settings.</para>
         </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>
index 81a4078c71eb3a35b2f3a35669d98bf54a2bc459..b1e3af2fefa485aead9214ad94c052c2fccc9b52 100644 (file)
                                 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>
 
index 31fb7bcd3fbe8b1a6b9b0a62c146522246e1e9f0..e3025d247b74c27a3b7b32f5c5fcbdeb0d81e491 100644 (file)
@@ -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
index fb7efcaa8880f7cfac76037d6ae65caf4761541e..4067930e3046c3b46a014fff9706b9ff7f607e11 100644 (file)
@@ -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" },
index 90e5e3a5c98de7090e2f110dbb70f024c591fcb5..404df76e325a8f1261bcd71f124b9f29e7b8c5f1 100644 (file)
@@ -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);
index 70cd372e1053f6775dd110d3def5ff53173502c2..88563b34f6d02a5d2bfb690759fd5ca5e9259660 100644 (file)
@@ -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;
         }
index 7cd4320d94e5ed7551211a5115ffdc2f00862a37..a9550697e59a150bb9aa46c110ac1bf7ae394f56 100644 (file)
@@ -58,7 +58,6 @@ typedef struct MountParameters {
         char *what;
         char *options;
         char *fstype;
-        int passno;
 } MountParameters;
 
 typedef enum MountResult {
index 96ed2d303a9073d268fd997fa8f836f8dec59cc7..ce757570219d5201df63d1a2850b809eb785b282 100644 (file)
@@ -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);
index ce5b5e04ab1e02bcb67256200bedd5bc9ccb5112..37fa6ff0fab6f09712e71ee5d27c4b6b8c506dce 100644 (file)
@@ -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;