diff options
author | Chandan Rajendra <chandan@linux.vnet.ibm.com> | 2016-03-23 17:39:11 +1100 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-03-23 17:39:11 +1100 |
commit | 1ffa40385a741dff38cde3e01c9eaa1e938f72ce (patch) | |
tree | 5a538a22c9504e2eaf28bc4404fbe5b7557514ae /tests/btrfs/060 | |
parent | 5af5146ef16c7996ee096b8f6190335c48f00658 (diff) |
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>
Diffstat (limited to 'tests/btrfs/060')
-rwxr-xr-x | tests/btrfs/060 | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/btrfs/060 b/tests/btrfs/060 index 8ef0e7f8..6b6a480a 100755 --- a/tests/btrfs/060 +++ b/tests/btrfs/060 @@ -56,6 +56,7 @@ 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 @@ -77,15 +78,18 @@ run_test() balance_pid=$! echo "$balance_pid" >>$seqres.full + # 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 echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full wait $fsstress_pid - kill $balance_pid $subvol_pid + touch $stop_file + kill $balance_pid wait # wait for the balance operation to finish while ps aux | grep "balance start" | grep -qv grep; do |