summaryrefslogtreecommitdiff
path: root/src/core/swap.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-05-04 10:46:13 +0200
committerLennart Poettering <lennart@poettering.net>2016-05-04 10:46:13 +0200
commit1ed7ebcfcaa952441565c1c8c43084add1f58a89 (patch)
tree9c2a3a4e826c8a0ebab05562d66b7070a3274dc6 /src/core/swap.c
parentd428dd6ac9a56e7b3421fb8ef3aac9937a4a2e62 (diff)
parentdbb0578edc5ab8e11641c8b2d29904d4f5f8e1e6 (diff)
Merge pull request #3170 from poettering/v230-preparation-fixes
make virtualization detection quieter, rework unit start limit logic, detect unit file drop-in changes correctly, fix autofs state propagation
Diffstat (limited to 'src/core/swap.c')
-rw-r--r--src/core/swap.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/swap.c b/src/core/swap.c
index c018648d87..a532b15be8 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -814,6 +814,7 @@ fail:
static int swap_start(Unit *u) {
Swap *s = SWAP(u), *other;
+ int r;
assert(s);
@@ -842,6 +843,12 @@ static int swap_start(Unit *u) {
if (UNIT(other)->job && UNIT(other)->job->state == JOB_RUNNING)
return -EAGAIN;
+ r = unit_start_limit_test(u);
+ if (r < 0) {
+ swap_enter_dead(s, SWAP_FAILURE_START_LIMIT_HIT);
+ return r;
+ }
+
s->result = SWAP_SUCCESS;
s->reset_cpu_usage = true;
@@ -1447,7 +1454,8 @@ static const char* const swap_result_table[_SWAP_RESULT_MAX] = {
[SWAP_FAILURE_TIMEOUT] = "timeout",
[SWAP_FAILURE_EXIT_CODE] = "exit-code",
[SWAP_FAILURE_SIGNAL] = "signal",
- [SWAP_FAILURE_CORE_DUMP] = "core-dump"
+ [SWAP_FAILURE_CORE_DUMP] = "core-dump",
+ [SWAP_FAILURE_START_LIMIT_HIT] = "start-limit-hit",
};
DEFINE_STRING_TABLE_LOOKUP(swap_result, SwapResult);