From: Dave Chinner <david@fromorbit.com>
To: fdmanana@kernel.org
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org,
Filipe Manana <fdmanana@suse.com>
Subject: Re: [PATCH] btrfs/028: kill lingering processes when test is interrupted
Date: Fri, 29 Nov 2024 07:30:31 +1100 [thread overview]
Message-ID: <Z0jS5zmObJTEWYTY@dread.disaster.area> (raw)
In-Reply-To: <7a257c21d2efe2706bac1f2fac8f7faff1d0423f.1732796051.git.fdmanana@suse.com>
On Thu, Nov 28, 2024 at 12:14:56PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> If we interrupt the test after it spawned the fsstress and balance
> processes (while it's sleeping for 30 seconds * $TIME_FACTOR), we don't
> kill them and they stay around for a long time, making it impossible to
> unmount the scratch filesystem (failing with -EBUSY).
>
> Fix this by adding a _cleanup function that kills the processes and
> waits for them to exit.
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> ---
> tests/btrfs/028 | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
IIRC there are several btrfs tests that run fsstress that need
similar fixes. I fixed this problem for fsstress across the entire
fstests code base in this patch I recently sent:
https://lore.kernel.org/fstests/20241127045403.3665299-3-david@fromorbit.com/
Avoiding needing to repeated rebase that work by having people
randomly fixing one-off instances like this is why I'd like those
large "fix everything" patches reviewed and merged sooner rather
than later...
Regardless,
> diff --git a/tests/btrfs/028 b/tests/btrfs/028
> index f64fc831..4ef83423 100755
> --- a/tests/btrfs/028
> +++ b/tests/btrfs/028
> @@ -13,6 +13,19 @@
> . ./common/preamble
> _begin_fstest auto qgroup balance
>
> +_cleanup()
> +{
> + cd /
> + rm -r -f $tmp.*
> + if [ ! -z "$balance_pid" ]; then
"! -z <var>" is the same as "-n <var>"
> + _btrfs_kill_stress_balance_pid $balance_pid
> + fi
> + if [ ! -z "$fsstress_pid" ]; then
> + kill $fsstress_pid &> /dev/null
> + wait $fsstress_pid &> /dev/null
> + fi
> +}
This really wants the balance_pid and fsstress_pid variables to be
unset after they are killed in normal execution so we don't try to
kill and wait for them a second time on exit.
-Dave.
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2024-11-28 20:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-28 12:14 [PATCH] btrfs/028: kill lingering processes when test is interrupted fdmanana
2024-11-28 13:14 ` David Sterba
2024-11-28 13:27 ` Zorro Lang
2024-11-28 20:30 ` Dave Chinner [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=Z0jS5zmObJTEWYTY@dread.disaster.area \
--to=david@fromorbit.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