summaryrefslogtreecommitdiff
path: root/tests/btrfs/067
diff options
context:
space:
mode:
authorChandan Rajendra <chandan@linux.vnet.ibm.com>2016-03-23 17:39:11 +1100
committerDave Chinner <david@fromorbit.com>2016-03-23 17:39:11 +1100
commit1ffa40385a741dff38cde3e01c9eaa1e938f72ce (patch)
tree5a538a22c9504e2eaf28bc4404fbe5b7557514ae /tests/btrfs/067
parent5af5146ef16c7996ee096b8f6190335c48f00658 (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/067')
-rwxr-xr-xtests/btrfs/0678
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/btrfs/067 b/tests/btrfs/067
index 2c1e284d..b76f5ec9 100755
--- a/tests/btrfs/067
+++ b/tests/btrfs/067
@@ -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