From: Lennart Poettering Date: Wed, 25 Feb 2015 21:05:14 +0000 (+0100) Subject: unit: use weaker dependencies between mount and device units in --user mode X-Git-Tag: v219.0~569 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=5bd4b173605142c7be493aa4d958ebaef21f421d;ds=sidebyside unit: use weaker dependencies between mount and device units in --user mode When running in user mode unmounting of mount units when a device vanishes is unlikely to work, and even if it would work is already done by PID 1 anyway. HEnce, when creating implicit dependencies between mount units and their backing devices, created a Wants= type dependency in --user mode, but leave a BindsTo= dependency in --system mode. --- diff --git a/src/core/unit.c b/src/core/unit.c index ad5348b57..875befa0a 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -2839,7 +2839,7 @@ int unit_add_node_link(Unit *u, const char *what, bool wants) { if (r < 0) return r; - r = unit_add_two_dependencies(u, UNIT_AFTER, UNIT_BINDS_TO, device, true); + r = unit_add_two_dependencies(u, UNIT_AFTER, u->manager->running_as == SYSTEMD_SYSTEM ? UNIT_BINDS_TO : UNIT_WANTS, device, true); if (r < 0) return r;