]> www.infradead.org Git - users/hch/xfstests-dev.git/commit
btrfs/06[0-9]..07[0-4]: kill all background tasks when test is killed/interrupted
authorFilipe Manana <fdmanana@suse.com>
Wed, 27 Mar 2024 17:11:44 +0000 (17:11 +0000)
committerAnand Jain <anand.jain@oracle.com>
Wed, 3 Apr 2024 07:08:54 +0000 (15:08 +0800)
commitc4d674bcd342cd8ccc9b5870031a025a633e3da4
treeb4bbc6297e174c066de913aebfc6815132ec1666
parentec3953895cadd6650cb54fbeb0f481df1c43b3ac
btrfs/06[0-9]..07[0-4]: kill all background tasks when test is killed/interrupted

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.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
15 files changed:
tests/btrfs/060
tests/btrfs/061
tests/btrfs/062
tests/btrfs/063
tests/btrfs/064
tests/btrfs/065
tests/btrfs/066
tests/btrfs/067
tests/btrfs/068
tests/btrfs/069
tests/btrfs/070
tests/btrfs/071
tests/btrfs/072
tests/btrfs/073
tests/btrfs/074