dryang / rpms / systemd

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