teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame 0013-unit-use-weaker-dependencies-between-mount-and-devic.patch

Zbigniew Jędrzejewski-Szmek e4a83a
From fc9805756d5c0088a3a67705bbf6bea30d0d35e5 Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek e4a83a
From: Lennart Poettering <lennart@poettering.net>
Zbigniew Jędrzejewski-Szmek e4a83a
Date: Wed, 25 Feb 2015 22:05:14 +0100
Zbigniew Jędrzejewski-Szmek e4a83a
Subject: [PATCH] unit: use weaker dependencies between mount and device units
Zbigniew Jędrzejewski-Szmek e4a83a
 in --user mode
Zbigniew Jędrzejewski-Szmek e4a83a
Zbigniew Jędrzejewski-Szmek e4a83a
When running in user mode unmounting of mount units when a device
Zbigniew Jędrzejewski-Szmek e4a83a
vanishes is unlikely to work, and even if it would work is already done
Zbigniew Jędrzejewski-Szmek e4a83a
by PID 1 anyway. HEnce, when creating implicit dependencies between
Zbigniew Jędrzejewski-Szmek e4a83a
mount units and their backing devices, created a Wants= type dependency
Zbigniew Jędrzejewski-Szmek e4a83a
in --user mode, but leave a BindsTo= dependency in --system mode.
Zbigniew Jędrzejewski-Szmek e4a83a
Zbigniew Jędrzejewski-Szmek e4a83a
(cherry picked from commit 5bd4b173605142c7be493aa4d958ebaef21f421d)
Zbigniew Jędrzejewski-Szmek e4a83a
---
Zbigniew Jędrzejewski-Szmek e4a83a
 src/core/unit.c | 2 +-
Zbigniew Jędrzejewski-Szmek e4a83a
 1 file changed, 1 insertion(+), 1 deletion(-)
Zbigniew Jędrzejewski-Szmek e4a83a
Zbigniew Jędrzejewski-Szmek e4a83a
diff --git a/src/core/unit.c b/src/core/unit.c
Zbigniew Jędrzejewski-Szmek e4a83a
index ee8e607c27..9f1e55e2f1 100644
Zbigniew Jędrzejewski-Szmek e4a83a
--- a/src/core/unit.c
Zbigniew Jędrzejewski-Szmek e4a83a
+++ b/src/core/unit.c
Zbigniew Jędrzejewski-Szmek e4a83a
@@ -2845,7 +2845,7 @@ int unit_add_node_link(Unit *u, const char *what, bool wants) {
Zbigniew Jędrzejewski-Szmek e4a83a
         if (r < 0)
Zbigniew Jędrzejewski-Szmek e4a83a
                 return r;
Zbigniew Jędrzejewski-Szmek e4a83a
 
Zbigniew Jędrzejewski-Szmek e4a83a
-        r = unit_add_two_dependencies(u, UNIT_AFTER, UNIT_BINDS_TO, device, true);
Zbigniew Jędrzejewski-Szmek e4a83a
+        r = unit_add_two_dependencies(u, UNIT_AFTER, u->manager->running_as == SYSTEMD_SYSTEM ? UNIT_BINDS_TO : UNIT_WANTS, device, true);
Zbigniew Jędrzejewski-Szmek e4a83a
         if (r < 0)
Zbigniew Jędrzejewski-Szmek e4a83a
                 return r;
Zbigniew Jędrzejewski-Szmek e4a83a