From: Anand Jain <anand.jain@oracle.com>
To: fdmanana@kernel.org, fstests@vger.kernel.org
Cc: linux-btrfs@vger.kernel.org, Filipe Manana <fdmanana@suse.com>
Subject: Re: [PATCH 10/10] btrfs/06[0-9]..07[0-4]: kill all background tasks when test is killed/interrupted
Date: Thu, 28 Mar 2024 17:48:53 +0800 [thread overview]
Message-ID: <b976a6da-4735-4dc6-8de4-8049ae8af6a1@oracle.com> (raw)
In-Reply-To: <48866623524ab565944db6f7fa61f6a0ce0c0996.1711558345.git.fdmanana@suse.com>
On 3/28/24 01:11, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> Test cases btrfs/06[0-9] and btrfs/07[0-4] exercise multiple concurrent
> operations while fsstress is running in parallel, and all these are left
> as child processes running in the background, which are correctly stopped
> if the tests are not interrupted/killed. However if any of these tests is
> interrupted/killed, it often leaves child processes still running in the
> background, which prevent further running fstests again. For example:
>
> $ /check -g auto
> (...)
> btrfs/060 394s ... 264s
> btrfs/061 83s ... 69s
> btrfs/062 109s ... 105s
> btrfs/063 52s ... 67s
> btrfs/064 53s ... 51s
> btrfs/065 88s ... 271s
> btrfs/066 127s ... 241s
> btrfs/067 435s ... 248s
> btrfs/068 161s ... ^C^C
> ^C
>
> $ ./check btrfs/068
> FSTYP -- btrfs
> PLATFORM -- Linux/x86_64 debian0 6.8.0-rc7-btrfs-next-153+ #1 SMP PREEMPT_DYNAMIC Mon Mar 4 17:19:19 WET 2024
> MKFS_OPTIONS -- /dev/sdb
> MOUNT_OPTIONS -- /dev/sdb /home/fdmanana/btrfs-tests/scratch_1
>
> our local _scratch_mkfs routine ...
> btrfs-progs v6.6.2
> See https://btrfs.readthedocs.io for more information.
>
> ERROR: unable to open /dev/sdb: Device or resource busy
> check: failed to mkfs $SCRATCH_DEV using specified options
> Interrupted!
> Passed all 0 tests
>
> In this case there was still a process running _btrfs_stress_subvolume()
> from common/btrfs.
>
> This is a bit annoying because it requires manually finding out which
> process is preventing unmounting the scratch device and then properly
> stop/kill it.
>
> So fix this by adding a _cleanup() function to all these tests and then
> making sure it stops all the child processes it spawned and are running
> in the background.
>
> All these tests have the same structure as they were part of the same
> patchset and from the same author.
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Thanks, Anand
> ---
> tests/btrfs/060 | 22 +++++++++++++++++++++-
> tests/btrfs/061 | 19 +++++++++++++++++++
> tests/btrfs/062 | 19 +++++++++++++++++++
> tests/btrfs/063 | 19 +++++++++++++++++++
> tests/btrfs/064 | 19 +++++++++++++++++++
> tests/btrfs/065 | 22 +++++++++++++++++++++-
> tests/btrfs/066 | 22 +++++++++++++++++++++-
> tests/btrfs/067 | 22 +++++++++++++++++++++-
> tests/btrfs/068 | 22 +++++++++++++++++++++-
> tests/btrfs/069 | 19 +++++++++++++++++++
> tests/btrfs/070 | 19 +++++++++++++++++++
> tests/btrfs/071 | 19 +++++++++++++++++++
> tests/btrfs/072 | 19 +++++++++++++++++++
> tests/btrfs/073 | 19 +++++++++++++++++++
> tests/btrfs/074 | 19 +++++++++++++++++++
> 15 files changed, 295 insertions(+), 5 deletions(-)
>
> diff --git a/tests/btrfs/060 b/tests/btrfs/060
> index 53cbd3a0..f74d9593 100755
> --- a/tests/btrfs/060
> +++ b/tests/btrfs/060
> @@ -10,6 +10,22 @@
> . ./common/preamble
> _begin_fstest auto balance subvol scrub
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$stop_file" ] && [ ! -z "$subvol_pid" ]; then
> + _btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file
> + fi
> + if [ ! -z "$balance_pid" ]; then
> + _btrfs_kill_stress_balance_pid $balance_pid
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -20,11 +36,12 @@ _require_scratch_nocheck
> _require_scratch_dev_pool 4
> _btrfs_get_profile_configs
>
> +stop_file=$TEST_DIR/$seq.stop.$$
> +
> run_test()
> {
> local mkfs_opts=$1
> local subvol_mnt=$TEST_DIR/$seq.mnt
> - local stop_file=$TEST_DIR/$seq.stop.$$
>
> echo "Test $mkfs_opts" >>$seqres.full
>
> @@ -53,9 +70,12 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
>
> _btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file
> + unset subvol_pid
> _btrfs_kill_stress_balance_pid $balance_pid
> + unset balance_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
> diff --git a/tests/btrfs/061 b/tests/btrfs/061
> index b8b2706c..fec90882 100755
> --- a/tests/btrfs/061
> +++ b/tests/btrfs/061
> @@ -10,6 +10,22 @@
> . ./common/preamble
> _begin_fstest auto balance scrub
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$balance_pid" ]; then
> + _btrfs_kill_stress_balance_pid $balance_pid
> + fi
> + if [ ! -z "$scrub_pid" ]; then
> + _btrfs_kill_stress_scrub_pid $scrub_pid
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -51,8 +67,11 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
> _btrfs_kill_stress_balance_pid $balance_pid
> + unset balance_pid
> _btrfs_kill_stress_scrub_pid $scrub_pid
> + unset scrub_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
> diff --git a/tests/btrfs/062 b/tests/btrfs/062
> index 59d581be..0b57681f 100755
> --- a/tests/btrfs/062
> +++ b/tests/btrfs/062
> @@ -10,6 +10,22 @@
> . ./common/preamble
> _begin_fstest auto balance defrag compress scrub
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$balance_pid" ]; then
> + _btrfs_kill_stress_balance_pid $balance_pid
> + fi
> + if [ ! -z "$defrag_pid" ]; then
> + _btrfs_kill_stress_defrag_pid $defrag_pid
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -52,8 +68,11 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
> _btrfs_kill_stress_balance_pid $balance_pid
> + unset balance_pid
> _btrfs_kill_stress_defrag_pid $defrag_pid
> + unset defrag_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
> diff --git a/tests/btrfs/063 b/tests/btrfs/063
> index 5ee2837f..99d9d2c1 100755
> --- a/tests/btrfs/063
> +++ b/tests/btrfs/063
> @@ -10,6 +10,22 @@
> . ./common/preamble
> _begin_fstest auto balance remount compress scrub
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$balance_pid" ]; then
> + _btrfs_kill_stress_balance_pid $balance_pid
> + fi
> + if [ ! -z "$remount_pid" ]; then
> + _btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -51,8 +67,11 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
> _btrfs_kill_stress_balance_pid $balance_pid
> + unset balance_pid
> _btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
> + unset remount_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
> diff --git a/tests/btrfs/064 b/tests/btrfs/064
> index 9e0b3b30..663442c6 100755
> --- a/tests/btrfs/064
> +++ b/tests/btrfs/064
> @@ -12,6 +12,22 @@
> . ./common/preamble
> _begin_fstest auto balance replace volume scrub
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$balance_pid" ]; then
> + _btrfs_kill_stress_balance_pid $balance_pid
> + fi
> + if [ ! -z "$replace_pid" ]; then
> + _btrfs_kill_stress_replace_pid $replace_pid
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -63,8 +79,11 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
> _btrfs_kill_stress_balance_pid $balance_pid
> + unset balance_pid
> _btrfs_kill_stress_replace_pid $replace_pid
> + unset replace_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
> diff --git a/tests/btrfs/065 b/tests/btrfs/065
> index f9e43cdc..b1e54fc8 100755
> --- a/tests/btrfs/065
> +++ b/tests/btrfs/065
> @@ -10,6 +10,22 @@
> . ./common/preamble
> _begin_fstest auto subvol replace volume scrub
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$stop_file" ] && [ ! -z "$subvol_pid" ]; then
> + _btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file
> + fi
> + if [ ! -z "$replace_pid" ]; then
> + _btrfs_kill_stress_replace_pid $replace_pid
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -21,12 +37,13 @@ _require_scratch_dev_pool 5
> _require_scratch_dev_pool_equal_size
> _btrfs_get_profile_configs replace
>
> +stop_file=$TEST_DIR/$seq.stop.$$
> +
> run_test()
> {
> local mkfs_opts=$1
> local saved_scratch_dev_pool=$SCRATCH_DEV_POOL
> local subvol_mnt=$TEST_DIR/$seq.mnt
> - local stop_file=$TEST_DIR/$seq.stop.$$
>
> echo "Test $mkfs_opts" >>$seqres.full
>
> @@ -61,9 +78,12 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
>
> _btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file
> + unset subvol_pid
> _btrfs_kill_stress_replace_pid $replace_pid
> + unset replace_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
> diff --git a/tests/btrfs/066 b/tests/btrfs/066
> index b6f904ac..feb6062e 100755
> --- a/tests/btrfs/066
> +++ b/tests/btrfs/066
> @@ -10,6 +10,22 @@
> . ./common/preamble
> _begin_fstest auto subvol scrub
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$stop_file" ] && [ ! -z "$subvol_pid" ]; then
> + _btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file
> + fi
> + if [ ! -z "$scrub_pid" ]; then
> + _btrfs_kill_stress_scrub_pid $scrub_pid
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -20,11 +36,12 @@ _require_scratch_nocheck
> _require_scratch_dev_pool 4
> _btrfs_get_profile_configs
>
> +stop_file=$TEST_DIR/$seq.stop.$$
> +
> run_test()
> {
> local mkfs_opts=$1
> local subvol_mnt=$TEST_DIR/$seq.mnt
> - local stop_file=$TEST_DIR/$seq.stop.$$
>
> echo "Test $mkfs_opts" >>$seqres.full
>
> @@ -53,9 +70,12 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
>
> _btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file
> + unset subvol_pid
> _btrfs_kill_stress_scrub_pid $scrub_pid
> + unset scrub_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
> diff --git a/tests/btrfs/067 b/tests/btrfs/067
> index 7be09d52..0bbfe83f 100755
> --- a/tests/btrfs/067
> +++ b/tests/btrfs/067
> @@ -10,6 +10,22 @@
> . ./common/preamble
> _begin_fstest auto subvol defrag compress scrub
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$stop_file" ] && [ ! -z "$subvol_pid" ]; then
> + _btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file
> + fi
> + if [ ! -z "$defrag_pid" ]; then
> + _btrfs_kill_stress_defrag_pid $defrag_pid
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -20,12 +36,13 @@ _require_scratch_nocheck
> _require_scratch_dev_pool 4
> _btrfs_get_profile_configs
>
> +stop_file=$TEST_DIR/$seq.stop.$$
> +
> run_test()
> {
> local mkfs_opts=$1
> local with_compress=$2
> local subvol_mnt=$TEST_DIR/$seq.mnt
> - local stop_file=$TEST_DIR/$seq.stop.$$
>
> echo "Test $mkfs_opts with $with_compress" >>$seqres.full
>
> @@ -54,9 +71,12 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
>
> _btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file
> + unset subvol_pid
> _btrfs_kill_stress_defrag_pid $defrag_pid
> + unset defrag_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
> diff --git a/tests/btrfs/068 b/tests/btrfs/068
> index 19e37010..7ab6feca 100755
> --- a/tests/btrfs/068
> +++ b/tests/btrfs/068
> @@ -11,6 +11,22 @@
> . ./common/preamble
> _begin_fstest auto subvol remount compress scrub
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$stop_file" ] && [ ! -z "$subvol_pid" ]; then
> + _btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file
> + fi
> + if [ ! -z "$remount_pid" ]; then
> + _btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -21,11 +37,12 @@ _require_scratch_nocheck
> _require_scratch_dev_pool 4
> _btrfs_get_profile_configs
>
> +stop_file=$TEST_DIR/$seq.stop.$$
> +
> run_test()
> {
> local mkfs_opts=$1
> local subvol_mnt=$TEST_DIR/$seq.mnt
> - local stop_file=$TEST_DIR/$seq.stop.$$
>
> echo "Test $mkfs_opts with $with_compress" >>$seqres.full
>
> @@ -54,9 +71,12 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
>
> _btrfs_kill_stress_subvolume_pid $subvol_pid $stop_file
> + unset subvol_pid
> _btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
> + unset remount_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
> diff --git a/tests/btrfs/069 b/tests/btrfs/069
> index ad1609d4..3fbfecdb 100755
> --- a/tests/btrfs/069
> +++ b/tests/btrfs/069
> @@ -10,6 +10,22 @@
> . ./common/preamble
> _begin_fstest auto replace scrub volume
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$replace_pid" ]; then
> + _btrfs_kill_stress_replace_pid $replace_pid
> + fi
> + if [ ! -z "$scrub_pid" ]; then
> + _btrfs_kill_stress_scrub_pid $scrub_pid
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -59,8 +75,11 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
> _btrfs_kill_stress_scrub_pid $scrub_pid
> + unset scrub_pid
> _btrfs_kill_stress_replace_pid $replace_pid
> + unset replace_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
> diff --git a/tests/btrfs/070 b/tests/btrfs/070
> index 3054c270..11fddc86 100755
> --- a/tests/btrfs/070
> +++ b/tests/btrfs/070
> @@ -10,6 +10,22 @@
> . ./common/preamble
> _begin_fstest auto replace defrag compress volume scrub
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$replace_pid" ]; then
> + _btrfs_kill_stress_replace_pid $replace_pid
> + fi
> + if [ ! -z "$defrag_pid" ]; then
> + _btrfs_kill_stress_defrag_pid $defrag_pid
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -60,8 +76,11 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
> _btrfs_kill_stress_replace_pid $replace_pid
> + unset replace_pid
> _btrfs_kill_stress_defrag_pid $defrag_pid
> + unset defrag_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
> diff --git a/tests/btrfs/071 b/tests/btrfs/071
> index 36b39341..1a91ec45 100755
> --- a/tests/btrfs/071
> +++ b/tests/btrfs/071
> @@ -10,6 +10,22 @@
> . ./common/preamble
> _begin_fstest auto replace remount compress volume scrub
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$replace_pid" ]; then
> + _btrfs_kill_stress_replace_pid $replace_pid
> + fi
> + if [ ! -z "$remount_pid" ]; then
> + _btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -59,8 +75,11 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
> _btrfs_kill_stress_replace_pid $replace_pid
> + unset replace_pid
> _btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
> + unset remount_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
> diff --git a/tests/btrfs/072 b/tests/btrfs/072
> index 505d0b57..e66e49c9 100755
> --- a/tests/btrfs/072
> +++ b/tests/btrfs/072
> @@ -10,6 +10,22 @@
> . ./common/preamble
> _begin_fstest auto scrub defrag compress
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$defrag_pid" ]; then
> + _btrfs_kill_stress_defrag_pid $defrag_pid
> + fi
> + if [ ! -z "$scrub_pid" ]; then
> + _btrfs_kill_stress_scrub_pid $scrub_pid
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -52,9 +68,12 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
>
> _btrfs_kill_stress_defrag_pid $defrag_pid
> + unset defrag_pid
> _btrfs_kill_stress_scrub_pid $scrub_pid
> + unset scrub_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
> diff --git a/tests/btrfs/073 b/tests/btrfs/073
> index 50358286..e6cfd92a 100755
> --- a/tests/btrfs/073
> +++ b/tests/btrfs/073
> @@ -10,6 +10,22 @@
> . ./common/preamble
> _begin_fstest auto scrub remount compress
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$remount_pid" ]; then
> + _btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
> + fi
> + if [ ! -z "$scrub_pid" ]; then
> + _btrfs_kill_stress_scrub_pid $scrub_pid
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -51,8 +67,11 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
> _btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
> + unset remount_pid
> _btrfs_kill_stress_scrub_pid $scrub_pid
> + unset scrub_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
> diff --git a/tests/btrfs/074 b/tests/btrfs/074
> index 6e93b36a..1dd88bcd 100755
> --- a/tests/btrfs/074
> +++ b/tests/btrfs/074
> @@ -10,6 +10,22 @@
> . ./common/preamble
> _begin_fstest auto defrag remount compress scrub
>
> +_cleanup()
> +{
> + cd /
> + rm -rf $tmp.*
> + if [ ! -z "$remount_pid" ]; then
> + _btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
> + fi
> + if [ ! -z "$defrag_pid" ]; then
> + _btrfs_kill_stress_defrag_pid $defrag_pid
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
> +
> # Import common functions.
> . ./common/filter
>
> @@ -52,8 +68,11 @@ run_test()
>
> echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
> wait $fsstress_pid
> + unset fsstress_pid
> _btrfs_kill_stress_remount_compress_pid $remount_pid $SCRATCH_MNT
> + unset remount_pid
> _btrfs_kill_stress_defrag_pid $defrag_pid
> + unset defrag_pid
>
> echo "Scrub the filesystem" >>$seqres.full
> $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
prev parent reply other threads:[~2024-03-28 9:49 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 17:11 [PATCH 00/10] fstests/btrfs: fixes for tests btrfs/06[0-9] and btrfs/07[0-4] fdmanana
2024-03-27 17:11 ` [PATCH 01/10] btrfs: add helper to kill background process running _btrfs_stress_balance fdmanana
2024-03-28 8:16 ` Anand Jain
2024-03-28 9:21 ` Filipe Manana
2024-03-27 17:11 ` [PATCH 02/10] btrfs/028: use the helper _btrfs_kill_stress_balance_pid fdmanana
2024-03-28 8:41 ` Anand Jain
2024-03-28 9:25 ` Filipe Manana
2024-03-27 17:11 ` [PATCH 03/10] btrfs/028: removed redundant sync and scratch filesystem unmount fdmanana
2024-03-27 17:11 ` [PATCH 04/10] btrfs: add helper to kill background process running _btrfs_stress_scrub fdmanana
2024-03-28 8:41 ` Anand Jain
2024-03-28 9:27 ` Filipe Manana
2024-03-27 17:11 ` [PATCH 05/10] btrfs: add helper to kill background process running _btrfs_stress_defrag fdmanana
2024-03-28 9:18 ` Anand Jain
2024-03-28 9:32 ` Filipe Manana
2024-03-27 17:11 ` [PATCH 06/10] btrfs: add helper to kill background process running _btrfs_stress_remount_compress fdmanana
2024-03-28 9:24 ` Anand Jain
2024-03-28 11:46 ` Anand Jain
2024-03-28 12:03 ` Filipe Manana
2024-03-28 12:50 ` Anand Jain
2024-03-27 17:11 ` [PATCH 07/10] btrfs: add helper to kill background process running _btrfs_stress_replace fdmanana
2024-03-28 9:35 ` Anand Jain
2024-03-27 17:11 ` [PATCH 08/10] btrfs: add helper to stop background process running _btrfs_stress_subvolume fdmanana
2024-03-28 9:36 ` Anand Jain
2024-03-27 17:11 ` [PATCH 09/10] btrfs: remove stop file early at _btrfs_stress_subvolume fdmanana
2024-03-28 9:38 ` Anand Jain
2024-03-27 17:11 ` [PATCH 10/10] btrfs/06[0-9]..07[0-4]: kill all background tasks when test is killed/interrupted fdmanana
2024-03-28 9:48 ` Anand Jain [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b976a6da-4735-4dc6-8de4-8049ae8af6a1@oracle.com \
--to=anand.jain@oracle.com \
--cc=fdmanana@kernel.org \
--cc=fdmanana@suse.com \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox