From a0d79df8e59c6bb6dc0382d71e835dec869a7df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Sekleta=CC=81r?= Date: Fri, 5 Jun 2020 11:35:01 +0200 Subject: [PATCH 1/2] tests: sleep a bit and give kernel time to perform the action after manual freeze/thaw Fixes: #16050 --- test/units/testsuite-38.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/units/testsuite-38.sh b/test/units/testsuite-38.sh index 6fcadb8f8e..18b7bd6dce 100755 --- a/test/units/testsuite-38.sh +++ b/test/units/testsuite-38.sh @@ -246,6 +246,8 @@ test_preserve_state() { echo -n " - freeze from outside: " echo 1 > /sys/fs/cgroup/"${slice}"/cgroup.freeze + # Give kernel some time to freeze the slice + sleep 1 # Our state should not be affected check_freezer_state "${slice}" "running" @@ -258,6 +260,8 @@ test_preserve_state() { echo -n " - thaw from outside: " echo 0 > /sys/fs/cgroup/"${slice}"/cgroup.freeze + sleep 1 + check_freezer_state "${unit}" "running" check_freezer_state "${slice}" "running" grep -q "frozen 0" /sys/fs/cgroup/"${slice}"/cgroup.events From 2884836e3c26fa76718319cdc6d13136bbc1354d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Sekleta=CC=81r?= Date: Fri, 5 Jun 2020 15:23:12 +0200 Subject: [PATCH 2/2] core: fix the return value in order to make sure we don't dipatch method return too early Actually, it is the same kind of problem as in d910f4c . Basically, we need to return 1 on success code path in slice_freezer_action(). Otherwise we dispatch DBus return message too soon. Fixes: #16050 --- src/core/slice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/slice.c b/src/core/slice.c index 38a2805200..f4f63fcb5b 100644 --- a/src/core/slice.c +++ b/src/core/slice.c @@ -403,7 +403,7 @@ static int slice_freezer_action(Unit *s, FreezerAction action) { if (r < 0) return r; - return 0; + return 1; } static int slice_freeze(Unit *s) {