]> www.infradead.org Git - users/hch/xfstests-dev.git/commit
xfs/{422,517}: kill background jobs on test termination v2022.06.26
authorAmir Goldstein <amir73il@gmail.com>
Tue, 21 Jun 2022 17:37:29 +0000 (20:37 +0300)
committerZorro Lang <zlang@kernel.org>
Fri, 24 Jun 2022 16:27:11 +0000 (00:27 +0800)
commit34c1208f601b5f22c62d0f3ed6f6c55c88aa4eff
tree11359878ee669f8ee96b2b862c3290b60f56b521
parentbc50d0f64a1beea66843ee07b0591658f5d1a986
xfs/{422,517}: kill background jobs on test termination

Those tests failed to cleanup background jobs properly after test
is interrupted and even sometimes when it completed succefully.

xfs/517 would sometime fails randomally with this false positive error:
     QA output created by 517
     Format and populate
     Concurrent fsmap and freeze
    +Terminated
     Test done

The tests have several background sub-shells that spawn short lived
programs in a loop.  By killing the spawned programs using killall,
killall could find no process to kill and the sub-shell loop could still
spawn another process that is not going to be killed and in the worst
case, the freeze_loop() could spawn the xfs_io "freeze" command after
test has thawn the fs before exit, which leaves the fs frozen after the
test.

The "Terminated" output is emitted by the sub-shell when killing the
programs that it has spawned when the loop did not finish before test
timeout.  By killing the sub-shell and not the spawned programs, we
avoid the false positive "Terminated" error.

Use a helper to perform this cleanup dance:
First kill and wait the freeze_loop so it won't try to freeze fs again
Then make sure fs is not frozen.
Then kill and wait for the rest of the sub-shells, because
if fs is frozen a killed writer process will never exit.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/xfs/422
tests/xfs/517