xfs: force file creation to the data device for certain layout tests
[xfstests-dev.git] / tests / generic / 051
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 051
6 #
7 # Basic log recovery stress test - do lots of stuff, shut down in the middle of
8 # it and check that recovery runs to completion and everything can be
9 # successfully removed afterwards..
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18
19 # get standard environment, filters and checks
20 . ./common/rc
21 . ./common/filter
22
23 _cleanup()
24 {
25         cd /
26         _scratch_unmount 2>/dev/null
27         rm -f $tmp.*
28 }
29 trap "_cleanup; exit \$status" 0 1 2 3 15
30
31 # real QA test starts here
32 _supported_fs generic
33
34 _require_scratch
35 _require_scratch_shutdown
36 _require_command "$KILLALL_PROG" killall
37
38 rm -f $seqres.full
39
40 _scratch_mkfs > $seqres.full 2>&1
41 _require_metadata_journaling $SCRATCH_DEV
42 _scratch_mount
43
44 SLEEP_TIME=$((30 * $TIME_FACTOR))
45 PROCS=$((2 * LOAD_FACTOR))
46
47 load_dir=$SCRATCH_MNT/test
48
49 # let this run for a while
50 $FSSTRESS_PROG $FSSTRESS_AVOID -n10000000 -p $PROCS -d $load_dir >> $seqres.full 2>&1 &
51 sleep $SLEEP_TIME
52 $KILLALL_PROG -q $FSSTRESS_PROG
53 wait
54 sync
55 _scratch_unmount
56
57 # now mount again, run the load again, this time with a shutdown.
58 _scratch_mount
59 $XFS_FSR_PROG -v $load_dir >> $seqres.full 2>&1
60 $FSSTRESS_PROG -n10000000 -p $PROCS -d $load_dir >> $seqres.full 2>&1 &
61 sleep $SLEEP_TIME
62 sync
63
64 # now shutdown and unmount
65 sleep 5
66 _scratch_shutdown
67 $KILLALL_PROG -q $FSSTRESS_PROG
68 wait
69
70 # for some reason fsstress processes manage to live on beyond the wait?
71 sleep 5
72 _scratch_unmount
73
74 # now recover, check the filesystem for consistency
75 _scratch_mount
76 _scratch_unmount
77 _check_scratch_fs
78
79 # now clean up.
80 _scratch_mount
81 for d in $load_dir/*; do
82         rm -rf $d > /dev/null 2>&1 &
83 done
84 wait
85 _scratch_unmount
86
87 echo "No output is good. Failures are loud."
88
89 status=0
90 exit