[systemd-devel] [PATCH 1/2] core: keep mountinfo .mounts until late shutdown

Umut Tezduyar umut at tezduyar.com
Mon Feb 4 06:00:38 PST 2013


.mount units coming from /proc/self/mountinfo file are
unmounted after local-fs.target is reached during shutdown.

Problem: .mount units popping up in mountinfo file are
added to systemd without any dependency. For that reason,
they are the first one to be unmounted during shutdown.
Whichever program mounted the file system deserves a
chance to also unmount it. This patch ensures that
/proc/self/mountinfo units will be unmounted after
local-fs.target during shutdown (if they haven't been
unmounted already)
---
 src/core/mount.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/core/mount.c b/src/core/mount.c
index 2aaf78c..29ce440 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1488,6 +1488,10 @@ static int mount_add_one(
                         goto fail;
                 }
 
+                r = unit_add_two_dependencies_by_name(u, UNIT_BEFORE, UNIT_REQUIRED_BY, SPECIAL_LOCAL_FS_TARGET, NULL, true);
+                if (r < 0)
+                        goto fail;
+
                 unit_add_to_load_queue(u);
         } else {
                 delete = false;
-- 
1.7.2.5



More information about the systemd-devel mailing list