2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Fujitsu. All Rights Reserved.
5 # FS QA Test No. btrfs/036
7 # Regression test for running snapshots and send concurrently.
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
20 # kill backgroud snapshots
21 if [ $snapshots_pid -ne 0 ] && ps -p $snapshots_pid | grep -q $snapshots_pid; then
22 kill -TERM $snapshots_pid 2> /dev/null
30 # Wait for any running 'btrfs subvolume snapshot' subcommand before
31 # exitting so that after the test kills the subshell running this
32 # function, it does not fail with EBUSY when unmounting the scratch
34 trap "wait; exit" SIGTERM
39 $BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT/snap_1 \
40 $SCRATCH_MNT/snap_$i >> $seqres.full 2>&1
46 trap "_cleanup ; exit \$status" 0 1 2 3 15
48 # get standard environment, filters and checks
52 # remove previous $seqres.full before test
55 # real QA test starts here
59 _scratch_mkfs > /dev/null 2>&1
62 touch $SCRATCH_MNT/foo
64 # get file with fragments by using backwards writes.
65 for i in `seq 10240 -1 1`; do
66 $XFS_IO_PROG -f -d -c "pwrite $(($i * 4096)) 4096" \
67 $SCRATCH_MNT/foo > /dev/null | _filter_xfs_io
70 $BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT \
71 $SCRATCH_MNT/snap_1 >> $seqres.full 2>&1
76 $BTRFS_UTIL_PROG send -f /dev/null $SCRATCH_MNT/snap_1 2>&1 | _filter_scratch