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