[systemd-devel] [PATCH] mount: Don't add conflicts with umount.target for certain mounts
Ross Lagerwall
rosslagerwall at gmail.com
Thu Jun 13 00:46:20 PDT 2013
At startup, mount_enumerate is called at manager startup.
This creates a unit for each mount point in /proc/self/mountinfo. If no
unit for the mount point has been loaded yet (which is quite possible
since mount_enumerate is called early), a unit is created and set to
conflict with umount.target. However, this should not happen for /,
/usr and any mount point marked with x-initrd.mount.
This caused systemd to incorrectly unmount / on shutdown.
---
src/core/mount.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/core/mount.c b/src/core/mount.c
index 10073b5..377cf44 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1538,9 +1538,12 @@ static int mount_add_one(
if (r < 0)
goto fail;
- r = unit_add_dependency_by_name(u, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true);
- if (r < 0)
- goto fail;
+ if (!path_equal(where, "/") && !path_equal(where, "/usr") &&
+ !mount_test_option(options, "x-initrd.mount")) {
+ r = unit_add_dependency_by_name(u, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true);
+ if (r < 0)
+ goto fail;
+ }
unit_add_to_load_queue(u);
} else {
--
1.8.3.1
More information about the systemd-devel
mailing list