summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-23 18:24:17 +0100
committerLennart Poettering <lennart@poettering.net>2015-11-23 18:24:17 +0100
commit681c8d81bdc946360d13185632d1920ffaeb5ad9 (patch)
tree9d4852f2d7642d04e1548a123e0f48bef5ee2232
parent062fc6d775f16fc1e98405bc31603fc36e20b65f (diff)
parent8bf23dc757dacaaf5a8d2c21aabf71aee08d1a04 (diff)
Merge pull request #1997 from fbuihuu/fix-swap-unit-ordering-dep
make sure all swap units are ordered before the swap target
-rw-r--r--src/core/swap.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/swap.c b/src/core/swap.c
index ee0838e676..b6e4372fc0 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -211,6 +211,8 @@ static int swap_add_device_links(Swap *s) {
}
static int swap_add_default_dependencies(Swap *s) {
+ int r;
+
assert(s);
if (!UNIT(s)->default_dependencies)
@@ -222,6 +224,12 @@ static int swap_add_default_dependencies(Swap *s) {
if (detect_container() > 0)
return 0;
+ /* swap units generated for the swap dev links are missing the
+ * ordering dep against the swap target. */
+ r = unit_add_dependency_by_name(UNIT(s), UNIT_BEFORE, SPECIAL_SWAP_TARGET, NULL, true);
+ if (r < 0)
+ return r;
+
return unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true);
}