diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2012-02-07 11:05:18 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2012-02-07 11:22:48 +0100 |
commit | db1355b1c181a4b1ac277064918d7c794dfb6edd (patch) | |
tree | 86b735b562803bbd534cc715434ab83314163468 | |
parent | d26e4270409506cd398875216413b651d6ee7de6 (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.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/mount.c b/src/mount.c index 3411b734c..0ae964b64 100644 --- a/src/mount.c +++ b/src/mount.c | |||
@@ -320,7 +320,7 @@ static bool needs_quota(MountParameters *p) { | |||
320 | } | 320 | } |
321 | 321 | ||
322 | static int mount_add_fstab_links(Mount *m) { | 322 | static int mount_add_fstab_links(Mount *m) { |
323 | const char *target, *after = NULL, *after2 = NULL; | 323 | const char *target, *after, *tu_wants = NULL; |
324 | MountParameters *p; | 324 | MountParameters *p; |
325 | Unit *tu; | 325 | Unit *tu; |
326 | int r; | 326 | int r; |
@@ -350,23 +350,27 @@ static int mount_add_fstab_links(Mount *m) { | |||
350 | 350 | ||
351 | if (mount_is_network(p)) { | 351 | if (mount_is_network(p)) { |
352 | target = SPECIAL_REMOTE_FS_TARGET; | 352 | target = SPECIAL_REMOTE_FS_TARGET; |
353 | after = SPECIAL_REMOTE_FS_PRE_TARGET; | 353 | after = tu_wants = SPECIAL_REMOTE_FS_PRE_TARGET; |
354 | after2 = SPECIAL_NETWORK_TARGET; | ||
355 | } else { | 354 | } else { |
356 | target = SPECIAL_LOCAL_FS_TARGET; | 355 | target = SPECIAL_LOCAL_FS_TARGET; |
357 | after = SPECIAL_LOCAL_FS_PRE_TARGET; | 356 | after = SPECIAL_LOCAL_FS_PRE_TARGET; |
358 | } | 357 | } |
359 | 358 | ||
360 | if ((r = manager_load_unit(UNIT(m)->manager, target, NULL, NULL, &tu)) < 0) | 359 | r = manager_load_unit(UNIT(m)->manager, target, NULL, NULL, &tu); |
360 | if (r < 0) | ||
361 | return r; | 361 | return r; |
362 | 362 | ||
363 | if (after) | 363 | if (tu_wants) { |
364 | if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, after, NULL, true)) < 0) | 364 | r = unit_add_dependency_by_name(tu, UNIT_WANTS, tu_wants, NULL, true); |
365 | if (r < 0) | ||
365 | return r; | 366 | return r; |
367 | } | ||
366 | 368 | ||
367 | if (after2) | 369 | if (after) { |
368 | if ((r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, after2, NULL, true)) < 0) | 370 | r = unit_add_dependency_by_name(UNIT(m), UNIT_AFTER, after, NULL, true); |
371 | if (r < 0) | ||
369 | return r; | 372 | return r; |
373 | } | ||
370 | 374 | ||
371 | if (automount) { | 375 | if (automount) { |
372 | Unit *am; | 376 | Unit *am; |