xfs: force file creation to the data device for certain layout tests
[xfstests-dev.git] / tests / btrfs / 078
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2014 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FSQA Test No. 078
6 #
7 # Regression test for a btrfs issue where creation of readonly snapshots caused
8 # the filesystem to get into an inconsistent state.
9 #
10 # This regression was introduced in the 3.17 kernel and fixed by reverting the
11 # following linux kernel commit:
12 #
13 #     Btrfs: race free update of commit root for ro snapshots
14 #     9c3b306e1c9e6be4be09e99a8fe2227d1005effc
15 #
16 seq=`basename $0`
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
19
20 tmp=`mktemp -d`
21 status=1        # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 15
23
24 _cleanup()
25 {
26         rm -fr $tmp
27 }
28
29 # get standard environment, filters and checks
30 . ./common/rc
31 . ./common/filter
32
33 # real QA test starts here
34 _supported_fs btrfs
35 _require_scratch
36
37 rm -f $seqres.full
38
39 workout()
40 {
41         ops=$1
42         procs=$2
43         num_snapshots=$3
44
45         _scratch_mkfs >> $seqres.full 2>&1
46         _scratch_mount
47
48         snapshot_cmd="$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT"
49         snapshot_cmd="$snapshot_cmd $SCRATCH_MNT/snap_\`date +'%H_%M_%S_%N'\`"
50         run_check $FSSTRESS_PROG -p $procs \
51             -x "$snapshot_cmd" -X $num_snapshots -d $SCRATCH_MNT -n $ops
52 }
53
54 ops=8000
55 procs=4
56 snapshots=100
57 workout $ops $procs $snapshots
58
59 # The fstests framework runs a file system check against the scratch device
60 # automatically when a test case finishes (if the test calls _require_scratch).
61 # That filesystem check (btrfsck, btrfs.fsck) failed reporting several fs
62 # inconsistencies. Therefore there's no need to call _check_scratch_fs here.
63
64 echo "Silence is golden"
65 status=0
66 exit