chiark / gitweb /
systemd: order remote mounts from mountinfo before remote-fs.target
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 4 Oct 2013 02:15:08 +0000 (22:15 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 4 Oct 2013 02:15:08 +0000 (22:15 -0400)
Usually the network is stopped before filesystems are umounted.
Ordering network filesystems before remote-fs.target means that their
unmounting will be performed earlier, and can terminate sucessfully.

https://bugs.freedesktop.org/show_bug.cgi?id=70002

src/core/mount.c

index 3d46557fb1d42864fcfac04006fb21f8ba7f1d3e..93bfa99f3fe123525b6c290fb9985a1100ef3681 100644 (file)
@@ -1440,6 +1440,9 @@ static int mount_add_one(
 
         u = manager_get_unit(m, e);
         if (!u) {
+                const char* const target =
+                        fstype_is_network(fstype) ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET;
+
                 delete = true;
 
                 u = unit_new(m, sizeof(Mount));
@@ -1466,7 +1469,7 @@ static int mount_add_one(
                         goto fail;
                 }
 
-                r = unit_add_dependency_by_name(u, UNIT_BEFORE, SPECIAL_LOCAL_FS_TARGET, NULL, true);
+                r = unit_add_dependency_by_name(u, UNIT_BEFORE, target, NULL, true);
                 if (r < 0)
                         goto fail;