summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2012-02-07 11:05:18 +0100
committerMichal Schmidt <mschmidt@redhat.com>2012-02-07 11:22:48 +0100
commitdb1355b1c181a4b1ac277064918d7c794dfb6edd (patch)
tree86b735b562803bbd534cc715434ab83314163468
parentd26e4270409506cd398875216413b651d6ee7de6 (diff)
mount: adjust dependencies for remote filesystems
Currently remote mounts automatically get: After=remote-fs-pre.target network.target remote-fs-pre.target is already After=network.target. Just make sure remote-fs-pre.target is pulled in by remote-fs.target if any remote filesystems are configured. For the mount units it is then sufficient to get: After=remote-fs-pre.target Later NetworkManager will hook its NM-wait-online.service into remote-fs-pre.target.wants in order to remove the need for the administrator to enable the service manually when he has any remote filesystems. https://bugzilla.redhat.com/show_bug.cgi?id=787314
-rw-r--r--src/mount.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/mount.c b/src/mount.c
index 3411b734cc..0ae964b648 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -320,7 +320,7 @@ static bool needs_quota(MountParameters *p) {
}
static int mount_add_fstab_links(Mount *m) {
- const char *target, *after = NULL, *after2 = NULL;
+ const char *target, *after, *tu_wants = NULL;
MountParameters *p;
Unit *tu;
int r;
@@ -350,23 +350,27 @@ static int mount_add_fstab_links(Mount *m) {
if (mount_is_network(p)) {
target = SPECIAL_REMOTE_FS_TARGET;
- after = SPECIAL_REMOTE_FS_PRE_TARGET;
- after2 = SPECIAL_NETWORK_TARGET;
+ after = tu_wants = SPECIAL_REMOTE_FS_PRE_TARGET;
} else {
target = SPECIAL_LOCAL_FS_TARGET;
after = SPECIAL_LOCAL_FS_PRE_TARGET;
}
- if ((r = manager_load_unit(UNIT(m)->manager, target, NULL, NULL, &tu)) < 0)
+ r = manager_load_unit(UNIT(m)->manager, target, NULL, NULL, &tu);
+ if (r < 0)
return r;
- if (after)
- if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, after, NULL, true)) < 0)
+ if (tu_wants) {
+ r = unit_add_dependency_by_name(tu, UNIT_WANTS, tu_wants, NULL, true);
+ if (r < 0)
return r;
+ }
- if (after2)
- if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, after2, NULL, true)) < 0)
+ if (after) {
+ r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, after, NULL, true);
+ if (r < 0)
return r;
+ }
if (automount) {
Unit *am;