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 _begin_fstest auto quick send snapshot
14 # Override the default cleanup function.
17 # kill backgroud snapshots
18 if [ $snapshots_pid -ne 0 ] && ps -p $snapshots_pid | grep -q $snapshots_pid; then
19 kill -TERM $snapshots_pid 2> /dev/null
27 # Wait for any running 'btrfs subvolume snapshot' subcommand before
28 # exitting so that after the test kills the subshell running this
29 # function, it does not fail with EBUSY when unmounting the scratch
31 trap "wait; exit" SIGTERM
36 $BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT/snap_1 \
37 $SCRATCH_MNT/snap_$i >> $seqres.full 2>&1
43 # Import common functions.
46 # real QA test starts here
50 _scratch_mkfs > /dev/null 2>&1
53 touch $SCRATCH_MNT/foo
55 # get file with fragments by using backwards writes.
56 for i in `seq 10240 -1 1`; do
57 $XFS_IO_PROG -f -d -c "pwrite $(($i * 4096)) 4096" \
58 $SCRATCH_MNT/foo > /dev/null | _filter_xfs_io
61 $BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT \
62 $SCRATCH_MNT/snap_1 >> $seqres.full 2>&1
67 $BTRFS_UTIL_PROG send -f /dev/null $SCRATCH_MNT/snap_1 2>&1 | _filter_scratch