2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2014 Red Hat Inc. All rights reserved.
5 # FSQA Test No. btrfs/068
7 # Run btrfs subvolume create/mount/umount/delete and remount with
8 # different compress algorithms simultaneously, with fsstress running
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
18 trap "_cleanup; exit \$status" 0 1 2 3 15
26 # get standard environment, filters and checks
30 # real QA test starts here
33 # we check scratch dev after each loop
34 _require_scratch_nocheck
35 _require_scratch_dev_pool 4
36 _btrfs_get_profile_configs
43 local subvol_mnt=$TEST_DIR/$seq.mnt
44 local stop_file=$TEST_DIR/$seq.stop.$$
46 echo "Test $mkfs_opts with $with_compress" >>$seqres.full
48 _scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
49 # make sure we created btrfs with desired options
51 echo "mkfs $mkfs_opts failed"
54 _scratch_mount >>$seqres.full 2>&1
56 args=`_scale_fsstress_args -p 20 -n 100 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
57 echo "Run fsstress $args" >>$seqres.full
58 $FSSTRESS_PROG $args >/dev/null 2>&1 &
61 # make sure the stop sign is not there
63 echo -n "Start subvolume worker: " >>$seqres.full
64 _btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file >/dev/null 2>&1 &
66 echo "$subvol_pid" >>$seqres.full
68 echo -n "Start remount worker: " >>$seqres.full
69 _btrfs_stress_remount_compress $SCRATCH_MNT >/dev/null 2>&1 &
71 echo "$remount_pid" >>$seqres.full
73 echo "Wait for fsstress to exit and kill all background workers" >>$seqres.full
79 # wait for the remount loop process to finish
80 while ps aux | grep "mount.*$SCRATCH_MNT" | grep -qv grep; do
84 echo "Scrub the filesystem" >>$seqres.full
85 $BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
87 echo "Scrub find errors in \"$mkfs_opts\" test" | tee -a $seqres.full
90 # in case the subvolume is still mounted
91 $UMOUNT_PROG $subvol_mnt >/dev/null 2>&1
93 # we called _require_scratch_nocheck instead of _require_scratch
94 # do check after test for each profile config
98 echo "Silence is golden"
99 for t in "${_btrfs_profile_configs[@]}"; do