summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-27 14:02:25 +0100
committerLennart Poettering <lennart@poettering.net>2015-11-27 14:02:25 +0100
commit97839ed6b7b19e2cb885a152b54fbd32334294e2 (patch)
tree98fe7d2a4ab96fb34756097030a6f5290372c1aa
parent2281b56044ac36c1eec0bfc61cf3b172bc9d52b9 (diff)
parent9d06297e262966de71095debd1537fc223f940a3 (diff)
Merge pull request #2017 from haraldh/nobinddevice2
core: Do not bind a mount unit to a device, if it was from mountinfo
-rw-r--r--src/core/mount.c2
-rw-r--r--src/core/socket.c2
-rw-r--r--src/core/swap.c2
-rw-r--r--src/core/unit.c6
-rw-r--r--src/core/unit.h2
5 files changed, 8 insertions, 6 deletions
diff --git a/src/core/mount.c b/src/core/mount.c
index 9b44357e90..2ad4ad4f42 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -335,7 +335,7 @@ static int mount_add_device_links(Mount *m) {
if (mount_is_auto(p) && UNIT(m)->manager->running_as == MANAGER_SYSTEM)
device_wants_mount = true;
- r = unit_add_node_link(UNIT(m), p->what, device_wants_mount);
+ r = unit_add_node_link(UNIT(m), p->what, device_wants_mount, m->from_fragment ? UNIT_BINDS_TO : UNIT_REQUIRES);
if (r < 0)
return r;
diff --git a/src/core/socket.c b/src/core/socket.c
index 687675b24e..860a1e3051 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -289,7 +289,7 @@ static int socket_add_device_link(Socket *s) {
return 0;
t = strjoina("/sys/subsystem/net/devices/", s->bind_to_device);
- return unit_add_node_link(UNIT(s), t, false);
+ return unit_add_node_link(UNIT(s), t, false, UNIT_BINDS_TO);
}
static int socket_add_default_dependencies(Socket *s) {
diff --git a/src/core/swap.c b/src/core/swap.c
index b6e4372fc0..5568898bd7 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -202,7 +202,7 @@ static int swap_add_device_links(Swap *s) {
return 0;
if (is_device_path(s->what))
- return unit_add_node_link(UNIT(s), s->what, UNIT(s)->manager->running_as == MANAGER_SYSTEM);
+ return unit_add_node_link(UNIT(s), s->what, UNIT(s)->manager->running_as == MANAGER_SYSTEM, UNIT_BINDS_TO);
else
/* File based swap devices need to be ordered after
* systemd-remount-fs.service, since they might need a
diff --git a/src/core/unit.c b/src/core/unit.c
index 0a02e38aa8..e6e67d27c8 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2840,7 +2840,7 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
}
}
-int unit_add_node_link(Unit *u, const char *what, bool wants) {
+int unit_add_node_link(Unit *u, const char *what, bool wants, UnitDependency dep) {
Unit *device;
_cleanup_free_ char *e = NULL;
int r;
@@ -2867,7 +2867,9 @@ 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, u->manager->running_as == MANAGER_SYSTEM ? UNIT_BINDS_TO : UNIT_WANTS, device, true);
+ r = unit_add_two_dependencies(u, UNIT_AFTER,
+ u->manager->running_as == MANAGER_SYSTEM ? dep : UNIT_WANTS,
+ device, true);
if (r < 0)
return r;
diff --git a/src/core/unit.h b/src/core/unit.h
index 1681bbf53b..3eb3484fb7 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -528,7 +528,7 @@ int unit_serialize_item_escaped(Unit *u, FILE *f, const char *key, const char *v
int unit_serialize_item_fd(Unit *u, FILE *f, FDSet *fds, const char *key, int fd);
void unit_serialize_item_format(Unit *u, FILE *f, const char *key, const char *value, ...) _printf_(4,5);
-int unit_add_node_link(Unit *u, const char *what, bool wants);
+int unit_add_node_link(Unit *u, const char *what, bool wants, UnitDependency d);
int unit_coldplug(Unit *u);