Update copyright annotations and license boilerplates to correspond with SGI Legals...
[xfstests-dev.git] / 068
1 #! /bin/sh
2 # FSQA Test No. 068
3 #
4 # Test case to reproduce xfs_freeze hang under filsystem load.
5 # The fail case for this test is a hang on an xfs_freeze.
6 #
7 #-----------------------------------------------------------------------
8 #  Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
9 #-----------------------------------------------------------------------
10 #
11 # creator
12 owner=ajones@sgi.com
13
14 seq=`basename $0`
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=0        # success is the default!
20
21 ITERATIONS=10
22
23 _cleanup()
24 {
25     cd /
26     _cleanup_testdir
27
28     trap 0 1 2 3 15
29     exit $status
30 }
31
32 trap "_cleanup" 0 1 2 3 15
33
34
35 # get standard environment, filters and checks
36 . ./common.rc
37 . ./common.filter
38
39 # real QA test starts here
40 _supported_fs xfs
41 _supported_os Linux IRIX
42
43 _require_scratch
44
45 echo "*** init FS"
46
47 rm -f $seq.full
48 umount $SCRATCH_DEV >/dev/null 2>&1
49 echo "*** MKFS ***"                         >>$seq.full
50 echo ""                                     >>$seq.full
51 _scratch_mkfs_xfs                           >>$seq.full 2>&1 \
52     || _fail "mkfs failed"
53 _scratch_mount                              >>$seq.full 2>&1 \
54     || _fail "mount failed"
55
56 touch $tmp.running
57
58
59 # start fsstress loop in a background block
60 {
61     STRESS_DIR="$SCRATCH_MNT/fsstress_test_dir"
62     mkdir "$STRESS_DIR"
63
64     procs=2
65     nops=200
66     while [ -f "$tmp.running" ]
67       do
68       # -w ensures that the only ops are ones which cause write I/O
69       ltp/fsstress -d $STRESS_DIR -w -p $procs -n $nops $FSSTRESS_AVOID \
70           > /dev/null 2>&1
71     done
72
73     rm -r $STRESS_DIR/*
74     rmdir $STRESS_DIR
75 } &
76
77 i=0
78 ITERATIONS=`expr $ITERATIONS - 1`
79
80 echo | tee -a $seq.full
81 while [ $i -le $ITERATIONS ]
82 do
83         echo "*** iteration: $i" | tee -a $seq.full
84         echo "*** freezing \$SCRATCH_MNT" | tee -a $seq.full
85         xfs_freeze -f "$SCRATCH_MNT" | tee -a $seq.full
86         [ $? != 0 ] && echo xfs_freeze -f "$SCRATCH_MNT" failed | \
87             tee -a $seq.full
88         sleep 2
89
90         echo "*** thawing  \$SCRATCH_MNT" | tee -a $seq.full
91         xfs_freeze -u "$SCRATCH_MNT" | tee -a $seq.full
92         [ $? != 0 ] && echo xfs_freeze -u "$SCRATCH_MNT" failed | \
93             tee -a $seq.full
94         sleep 2
95
96         echo  | tee -a $seq.full
97         i=`expr $i + 1`
98 done
99
100 # stop fsstress iterations
101 rm $tmp.running
102
103 # wait for fsstresses to finish
104 wait
105
106 _check_scratch_fs
107
108 exit 1