When the test case zbd/014 completes, it leaves a 'cat' command process. The test case runs trace_block_io() in the background, and records its PID to kill it later. However, the function runs 'cat trace_pipe' in a nested subshell, so killing only the outer subshell leaves the cat process running. The leftover cat process keeps trace_pipe open, which makes later writes to current_tracer fail with EBUSY. This causes other test cases such as blktrace/002 to fail. Run the function body without the nested subshell and exec cat, so that the recorded PID is that of cat itself. Fixes: 2f543de209e3 ("zbd/014: Test recursive bio splitting") Signed-off-by: Shin'ichiro Kawasaki --- tests/zbd/014 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/zbd/014 b/tests/zbd/014 index 18e6fd9..9dad3a7 100755 --- a/tests/zbd/014 +++ b/tests/zbd/014 @@ -34,10 +34,12 @@ requires() { fi } -# Start block I/O tracing with filter "$1". +# Start block I/O tracing with filter "$1". This function must be run in the +# background, since it replaces the calling process with cat. The caller can +# keep the PID of the cat process so that it can kill it. trace_block_io() { if [ -e /sys/kernel/tracing/tracing_on ]; then - ( + { set -e cd /sys/kernel/tracing lsof -t trace_pipe | xargs -r kill @@ -59,8 +61,8 @@ trace_block_io() { done echo 1 > tracing_on echo "Tracing has been enabled" >>"$FULL" - cat trace_pipe > "${FULL%.full}-block-trace.txt" - ) + exec cat trace_pipe > "${FULL%.full}-block-trace.txt" + } fi } -- 2.56.0