tests: remove udf/101
[xfstests-dev.git] / tests / shared / 001
1 #! /bin/bash
2 # FS QA Test No. 001
3 #
4 # Test truncate orphan inodes when mounting extN.
5 # ext4 used to hit WARNING, this commit fixed the issue
6 #
7 # 721e3eb ext4: lock i_mutex when truncating orphan inodes
8 #
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2015 Red Hat Inc.  All Rights Reserved.
11 #
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
15 #
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24 #-----------------------------------------------------------------------
25 #
26
27 seq=`basename $0`
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
30
31 here=`pwd`
32 tmp=/tmp/$$
33 status=1        # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
35
36 _cleanup()
37 {
38         cd /
39         rm -f $tmp.*
40 }
41
42 # get standard environment, filters and checks
43 . ./common/rc
44 . ./common/filter
45
46 # real QA test starts here
47 _supported_fs ext2 ext3 ext4
48 _supported_os Linux
49 _require_scratch
50
51 rm -f $seqres.full
52 echo "Silence is golden"
53
54 _scratch_mkfs_sized $((16*1024*1024)) >>$seqres.full 2>&1
55 _scratch_mount
56
57 # create a file and get its inode number, usually it's 12, but to be accurate
58 testfile=$SCRATCH_MNT/testfile
59 touch $testfile
60 inode=`ls -i $testfile | awk '{print $1}'`
61
62 # add the inode in orphan inode list
63 _scratch_unmount
64 debugfs -w -R "set_super_value last_orphan $inode" $SCRATCH_DEV \
65         >>$seqres.full 2>&1
66
67 # mount again to truncate orphan inode, _check_dmesg will catch the WARNING
68 _scratch_mount
69
70 status=0
71 exit