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