46a556f
From 5dd95bcdf143f7b33ddd557130a39e0633501c1f Mon Sep 17 00:00:00 2001
46a556f
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
46a556f
Date: Thu, 3 Oct 2013 22:15:08 -0400
46a556f
Subject: [PATCH] systemd: order remote mounts from mountinfo before
46a556f
 remote-fs.target
46a556f
46a556f
Usually the network is stopped before filesystems are umounted.
46a556f
Ordering network filesystems before remote-fs.target means that their
46a556f
unmounting will be performed earlier, and can terminate sucessfully.
46a556f
46a556f
https://bugs.freedesktop.org/show_bug.cgi?id=70002
46a556f
---
46a556f
 src/core/mount.c | 5 ++++-
46a556f
 1 file changed, 4 insertions(+), 1 deletion(-)
46a556f
46a556f
diff --git a/src/core/mount.c b/src/core/mount.c
46a556f
index 4f24555..6521a17 100644
46a556f
--- a/src/core/mount.c
46a556f
+++ b/src/core/mount.c
46a556f
@@ -1508,6 +1508,9 @@ static int mount_add_one(
46a556f
 
46a556f
         u = manager_get_unit(m, e);
46a556f
         if (!u) {
46a556f
+                const char* const target =
46a556f
+                        fstype_is_network(fstype) ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET;
46a556f
+
46a556f
                 delete = true;
46a556f
 
46a556f
                 u = unit_new(m, sizeof(Mount));
46a556f
@@ -1534,7 +1537,7 @@ static int mount_add_one(
46a556f
                         goto fail;
46a556f
                 }
46a556f
 
46a556f
-                r = unit_add_dependency_by_name(u, UNIT_BEFORE, SPECIAL_LOCAL_FS_TARGET, NULL, true);
46a556f
+                r = unit_add_dependency_by_name(u, UNIT_BEFORE, target, NULL, true);
46a556f
                 if (r < 0)
46a556f
                         goto fail;
46a556f