Skip to contentSkip to conversation

cgroup_fj_function.sh: Wait for $pid before cleanup

PATCH New Cyril Hrubis 1 participant 1 message Oct 17, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cgroup_fj_function.sh: Wait for $pid before cleanup

There seems to be rare race condition where the ltp subgroup created for the test cannot be removed:

...
cgroup_fj_function2_cpu 9 TPASS : Set /sys/fs/cgroup/cpu,cpuacct/ltp/ltp_1/notify_on_release to 1 cgroup_fj_function2_cpu 10 TINFO : Removing all ltp subgroups...
rmdir: failed to remove '/sys/fs/cgroup/cpu,cpuacct/ltp/': Device or resource busy

The reason for the failure is likely the cgroup_fj_proc that ends up in tasks for the ltp/ subgroup after test5(). This patch simply adds a 'wait $pid' after the 'kill -9 $pid' to avoid it.

---
 testcases/kernel/controllers/cgroup_fj/cgroup_fj_function.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/controllers/cgroup_fj/cgroup_fj_function.sh +2 -1
index 006798a..633f256 100755
@@ -207,7 +207,8 @@ test7
 test8
 test9
 
-ROD rmdir "$start_path/ltp_1"
 ROD kill -9 $pid
+wait $pid
+ROD rmdir "$start_path/ltp_1"
 
 tst_exit
Signature · 6 lines
2.7.3


-- 
Cyril Hrubis
[email protected]