Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs/255: add _cleanup function to kill the balance stress process
@ 2026-09-17 15:52 fdmanana
  2026-09-17 21:45 ` Qu Wenruo
  2026-09-20 11:49 ` Zorro Lang
  0 siblings, 2 replies; 3+ messages in thread
From: fdmanana @ 2026-09-17 15:52 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Filipe Manana

From: Filipe Manana <fdmanana@suse.com>

Currently if we interrupt the test and balance stress process is already
running, it keeps running after the test is interrupted, requiring the
user to manually kill the balance stress process before it can run any
fstest that uses the scratch device. So add a _cleanup function that
ensures the balance stress process is killed when the test is interrupted.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 tests/btrfs/255 | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tests/btrfs/255 b/tests/btrfs/255
index 14c12904..fbcbf57c 100755
--- a/tests/btrfs/255
+++ b/tests/btrfs/255
@@ -12,6 +12,15 @@
 . ./common/preamble
 _begin_fstest auto qgroup balance
 
+_cleanup()
+{
+	cd /
+	rm -rf $tmp.*
+	if [ -n "$balance_pid" ]; then
+		_btrfs_kill_stress_balance_pid $balance_pid
+	fi
+}
+
 _require_scratch
 
 _scratch_mkfs >> $seqres.full 2>&1
@@ -40,8 +49,6 @@ for ((i = 0; i < 20; i++)); do
 	$BTRFS_UTIL_PROG quota disable $SCRATCH_MNT
 done
 
-_btrfs_kill_stress_balance_pid $balance_pid
-
 echo "Silence is golden"
 status=0
 exit
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-20 11:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 15:52 [PATCH] btrfs/255: add _cleanup function to kill the balance stress process fdmanana
2026-09-17 21:45 ` Qu Wenruo
2026-09-20 11:49 ` Zorro Lang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox