[systemd-commits] 7 commits - man/systemd.service.xml src/fsck.c src/load-fragment.c src/log.c src/manager.c src/mount.c units/fsck-root.service.in units/quotacheck.service.in units/quotaon.service
Lennart Poettering
lennart at kemper.freedesktop.org
Wed Oct 20 05:42:25 PDT 2010
man/systemd.service.xml | 27 +++++++++++++++++++++++++++
src/fsck.c | 12 +++++++++---
src/load-fragment.c | 27 +++++++++++++++++++++++++++
src/log.c | 6 ++++--
src/manager.c | 10 ++++++----
src/mount.c | 3 ++-
units/fsck-root.service.in | 1 +
units/quotacheck.service.in | 2 +-
units/quotaon.service | 2 +-
9 files changed, 78 insertions(+), 12 deletions(-)
New commits:
commit 1f5558b4990c683d69e10217f1bf73ecb66ca2d2
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Oct 20 14:41:07 2010 +0200
manager: properly parse finish timestamp
diff --git a/src/manager.c b/src/manager.c
index 37f0d04..e90757e 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2562,8 +2562,8 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
} else if (startswith(l, "finish-timestamp=")) {
unsigned long long a, b;
- if (sscanf(l+18, "%lli %llu", &a, &b) != 2)
- log_debug("Failed to parse finish timestamp value %s", l+18);
+ if (sscanf(l+17, "%lli %llu", &a, &b) != 2)
+ log_debug("Failed to parse finish timestamp value %s", l+17);
else {
m->finish_timestamp.realtime = a;
m->finish_timestamp.monotonic = b;
commit f2382a94e0fd5d2482e0b2fe120674a6e156ff80
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Oct 20 14:40:44 2010 +0200
manager: properly write header marker on serialization
diff --git a/src/manager.c b/src/manager.c
index fb2656e..37f0d04 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2490,15 +2490,17 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds) {
assert(f);
assert(fds);
- fprintf(f, "startup-timestamp=%llu %llu\n\n",
+ fprintf(f, "startup-timestamp=%llu %llu\n",
(unsigned long long) m->startup_timestamp.realtime,
(unsigned long long) m->startup_timestamp.monotonic);
if (dual_timestamp_is_set(&m->finish_timestamp))
- fprintf(f, "finish-timestamp=%llu %llu\n\n",
+ fprintf(f, "finish-timestamp=%llu %llu\n",
(unsigned long long) m->finish_timestamp.realtime,
(unsigned long long) m->finish_timestamp.monotonic);
+ fputc('\n', f);
+
HASHMAP_FOREACH_KEY(u, t, m->units, i) {
if (u->meta.id != t)
continue;
commit b65a25f256505165660ab388d53446be17021d55
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Oct 20 14:26:46 2010 +0200
mount: do not implicitly pull in fsck service for root dir
diff --git a/src/mount.c b/src/mount.c
index 53edf9d..5aa51de 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -360,7 +360,8 @@ static int mount_add_device_links(Mount *m) {
}
if (p->passno > 0 &&
- UNIT(m)->meta.manager->running_as == MANAGER_SYSTEM) {
+ UNIT(m)->meta.manager->running_as == MANAGER_SYSTEM &&
+ !path_equal(m->where, "/")) {
char *name;
Unit *fsck;
/* Let's add in the fsck service */
commit ba5beeb1746dfc442c9476d93fddf2cb45d17cf1
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Oct 20 14:22:49 2010 +0200
units: properly use ConditionPathExists= instead of ConditionFileExists=
diff --git a/units/quotacheck.service.in b/units/quotacheck.service.in
index 9c8d7c8..089cffe 100644
--- a/units/quotacheck.service.in
+++ b/units/quotacheck.service.in
@@ -10,7 +10,7 @@ Description=Quota Check
DefaultDependencies=no
After=systemd-readahead-collect.service systemd-readahead-replay.service
Before=local-fs.target shutdown.target
-ConditionFileExists=/sbin/quotacheck
+ConditionPathExists=/sbin/quotacheck
[Service]
Type=oneshot
diff --git a/units/quotaon.service b/units/quotaon.service
index 60f6be6..deaa917 100644
--- a/units/quotaon.service
+++ b/units/quotaon.service
@@ -10,7 +10,7 @@ Description=Quota Check
DefaultDependencies=no
After=systemd-readahead-collect.service systemd-readahead-replay.service quotacheck.service
Before=local-fs.target shutdown.target
-ConditionFileExists=/sbin/quotaon
+ConditionPathExists=/sbin/quotaon
[Service]
Type=oneshot
commit 2ba545f1a098fc5621d4d1f1049af2f40793819a
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Oct 20 14:22:23 2010 +0200
service: implement FsckPassNo= option
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index 4473c3d..2db146b 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -638,6 +638,33 @@
refers to.</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/load-fragment.c b/src/load-fragment.c
index 2b5c8e7..0502fc4 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -1002,6 +1002,32 @@ static int config_parse_sysv_priority(
}
#endif
+static int config_parse_fsck_passno(
+ const char *filename,
+ unsigned line,
+ const char *section,
+ const char *lvalue,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ int *passno = data;
+ int r, i;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ if ((r = safe_atoi(rvalue, &i)) < 0 || i < 0) {
+ log_error("[%s:%u] Failed to parse fsck pass number, ignoring: %s", filename, line, rvalue);
+ return 0;
+ }
+
+ *passno = (int) i;
+ return 0;
+}
+
static DEFINE_CONFIG_PARSE_ENUM(config_parse_kill_mode, kill_mode, KillMode, "Failed to parse kill mode");
static int config_parse_kill_signal(
@@ -1781,6 +1807,7 @@ static int load_from_path(Unit *u, const char *path) {
{ "BusName", config_parse_string_printf, &u->service.bus_name, "Service" },
{ "NotifyAccess", config_parse_notify_access, &u->service.notify_access, "Service" },
{ "Sockets", config_parse_service_sockets, &u->service, "Service" },
+ { "FsckPassNo", config_parse_fsck_passno, &u->service.fsck_passno, "Service" },
EXEC_CONTEXT_CONFIG_ITEMS(u->service.exec_context, "Service"),
{ "ListenStream", config_parse_listen, &u->socket, "Socket" },
diff --git a/units/fsck-root.service.in b/units/fsck-root.service.in
index 987503a..8ddbda9 100644
--- a/units/fsck-root.service.in
+++ b/units/fsck-root.service.in
@@ -15,3 +15,4 @@ Before=local-fs.target shutdown.target remount-rootfs.service quotacheck.service
Type=oneshot
RemainAfterExit=no
ExecStart=@rootlibexecdir@/systemd-fsck
+FsckPassNo=1
commit dcdf86bbb07de0022d48e1c3d3941cc7ac12d138
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Oct 20 00:56:26 2010 +0200
log: reopen console so that we have logging on shutdown
diff --git a/src/log.c b/src/log.c
index d82747e..575ed51 100644
--- a/src/log.c
+++ b/src/log.c
@@ -212,6 +212,9 @@ int log_open(void) {
}
log_close_syslog();
+
+ /* Get the real /dev/console if we are PID=1, hence reopen */
+ log_close_console();
return log_open_console();
}
@@ -519,10 +522,9 @@ void log_parse_environment(void) {
if (log_show_color_from_string(e) < 0)
log_warning("Failed to parse bool %s. Ignoring.", e);
- if ((e = getenv("SYSTEMD_LOG_LOCATION"))) {
+ if ((e = getenv("SYSTEMD_LOG_LOCATION")))
if (log_show_location_from_string(e) < 0)
log_warning("Failed to parse bool %s. Ignoring.", e);
- }
}
LogTarget log_get_target(void) {
commit dc8e15c206ace4f9b424ea6c114a2bc7ee127eab
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Oct 20 00:44:09 2010 +0200
fsck: don't be idempotent for root directories
diff --git a/src/fsck.c b/src/fsck.c
index eca2212..e13dcf4 100644
--- a/src/fsck.c
+++ b/src/fsck.c
@@ -142,6 +142,7 @@ int main(int argc, char *argv[]) {
struct udev *udev = NULL;
struct udev_device *udev_device = NULL;
const char *device;
+ bool root_directory;
if (argc > 2) {
log_error("This program expects one or no arguments.");
@@ -158,9 +159,10 @@ int main(int argc, char *argv[]) {
if (!arg_force && arg_skip)
return 0;
- if (argc > 1)
+ if (argc > 1) {
device = argv[1];
- else {
+ root_directory = false;
+ } else {
struct stat st;
/* Find root device */
@@ -188,13 +190,17 @@ int main(int argc, char *argv[]) {
log_error("Failed to detect device node of root directory.");
goto finish;
}
+
+ root_directory = true;
}
cmdline[i++] = "/sbin/fsck";
cmdline[i++] = "-a";
cmdline[i++] = "-T";
cmdline[i++] = "-C";
- cmdline[i++] = "-M";
+
+ if (!root_directory)
+ cmdline[i++] = "-M";
if (arg_force)
cmdline[i++] = "-f";
More information about the systemd-commits
mailing list