chiark / gitweb /
mount: fix automount regression
authorMichal Schmidt <mschmidt@redhat.com>
Thu, 26 Jan 2012 00:19:19 +0000 (01:19 +0100)
committerMichal Schmidt <mschmidt@redhat.com>
Thu, 26 Jan 2012 00:19:19 +0000 (01:19 +0100)
Tom Gundersen noticed a regression where comment=systemd.automount in
fstab no longer prevented the adding of the After=foo.mount dependency
into local-fs.target. He bisected it to commit 9ddc4a26.

It turns out that clearing the default_dependencies flag is necessary
after all, in order to avoid complementing of Wants= with After= in the
target unit. We still want to add the dependencies on quota units and
umount.target though.

src/mount.c

index 6d0af4ef711555397762281b1caa4eb38d46fc89..965f70567b877601883b56d7d7fb02b20e291058 100644 (file)
@@ -583,6 +583,11 @@ static int mount_load(Unit *u) {
 
                 if (UNIT(m)->fragment_path)
                         m->from_fragment = true;
+                else if (m->from_etc_fstab)
+                        /* We always add several default dependencies to fstab mounts,
+                         * but we do not want the implicit complementing of Wants= with After=
+                         * in the target unit that this mount unit will be hooked into. */
+                        UNIT(m)->default_dependencies = false;
 
                 if (!m->where)
                         if (!(m->where = unit_name_to_path(u->id)))
@@ -615,7 +620,7 @@ static int mount_load(Unit *u) {
                 if ((r = mount_add_fstab_links(m)) < 0)
                         return r;
 
-                if (UNIT(m)->default_dependencies)
+                if (UNIT(m)->default_dependencies || m->from_etc_fstab)
                         if ((r = mount_add_default_dependencies(m)) < 0)
                                 return r;