mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
btrfs: 'subvolume stress' tasks need to exit gracefully
The following scenario can occur when running btrfs/066,
Task A Task B Task C
run_test()
- Execute _btrfs_stress_subvolume()
in a background shell.
_btrfs_stress_subvolme()
...
- fork & exec "mount"
Mount subvolume on directory in $TEST_DIR
- Wait for fsstress to finish do_mount()
- kill shell process executing - btrfs_mount()
_btrfs_stress_subvolume()
i.e. Task B.
- Init process becomes the parent
of "subvolume mount" task
i.e. Task C.
- In case subvolume is mounted
(which is not the case),
unmount it.
- Complete mounting subvolume
Hence on the completion of one iteration of run_test(), the subvolume
created inside the filesystem on $SCRATCH_DEV continues to be mounted on
$TEST_DIR/$seq.mnt. Subsequent invocations of run_test() (called for
remaining Btrfs profile configs) fail during _scratch_pool_mkfs.
Instead of killing the 'subvolume stress' task this commit makes
_btrfs_stress_subvolume() to break out of the loop when a file exists
on the filesystem. The commit also makes relevant changes to other
users of _btrfs_stress_subvolume() i.e. btrfs/060, btrfs/065,
btrfs/067 & btrfs/068.
Suggested-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
committed by
Dave Chinner
parent
5af5146ef1
commit
1ffa40385a
+6
-2
@@ -57,6 +57,7 @@ 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
|
||||
|
||||
@@ -73,8 +74,10 @@ run_test()
|
||||
$FSSTRESS_PROG $args >/dev/null 2>&1 &
|
||||
fsstress_pid=$!
|
||||
|
||||
# make sure the stop sign is not there
|
||||
rm -f $stop_file
|
||||
echo -n "Start subvolume worker: " >>$seqres.full
|
||||
_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt >/dev/null 2>&1 &
|
||||
_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
|
||||
subvol_pid=$!
|
||||
echo "$subvol_pid" >>$seqres.full
|
||||
|
||||
@@ -86,7 +89,8 @@ run_test()
|
||||
echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
|
||||
wait $fsstress_pid
|
||||
|
||||
kill $subvol_pid $defrag_pid
|
||||
touch $stop_file
|
||||
kill $defrag_pid
|
||||
wait
|
||||
# wait for btrfs defrag process to exit, otherwise it will block umount
|
||||
while ps aux | grep "btrfs filesystem defrag" | grep -qv grep; do
|
||||
|
||||
Reference in New Issue
Block a user