On Tue, May 24, 2022 at 12:12 PM Dave Chinner <david@xxxxxxxxxxxxx> wrote: > > From: Dave Chinner <dchinner@xxxxxxxxxx> > > When I ctrl-c g/038, it either does nothing or it leaves processes > running in the background. It is not cleaning up it's background > processes correctly, so add kill vectors into the cleanup. Make sure > we only kill in the cleanup trap if the background processes are > running. > > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> > --- > tests/generic/038 | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/tests/generic/038 b/tests/generic/038 > index c6cea94e..0462ea13 100755 > --- a/tests/generic/038 > +++ b/tests/generic/038 > @@ -36,6 +36,10 @@ _begin_fstest auto stress trim > # Override the default cleanup function. > _cleanup() > { > + [ -n "${create_pids}" ] && kill ${create_pids[@]} > + [ -n "${fallocate_pids}" ] && kill ${fallocate_pids[@]} > + [ -n "${trim_pids}" ] && kill ${trim_pids[@]} > + wait Following the pattern of recently fixed generic/019, Please redirect stderr of kill to /dev/null and I think we would rather not wait in cleanup callbacks which could potentially block forever? > rm -fr $tmp I suppose another patch is going to replace that with the proper _cleanup()? Patches from vger have been VERY slowly trickling into my mailbox. > } > > @@ -47,6 +51,8 @@ _supported_fs generic > _require_scratch > _require_xfs_io_command "falloc" > > +echo "Silence is golden" > + > # Keep allocating and deallocating 1G of data space with the goal of creating > # and deleting 1 block group constantly. The intention is to race with the > # fstrim loop below. > @@ -121,6 +127,7 @@ _scratch_mount > _require_fs_space $SCRATCH_MNT $((10 * 1024 * 1024)) > _require_batched_discard $SCRATCH_MNT > > + > for ((i = 0; i < $((4 * $LOAD_FACTOR)); i++)); do > trim_loop & > trim_pids[$i]=$! > @@ -136,12 +143,9 @@ create_files "foobar" > kill ${fallocate_pids[@]} > kill ${trim_pids[@]} > wait > +unset create_pids This one should be moved up to after the wait in create_files() Thanks, Amir.