4 # Test out xfs_repair_ipaths
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
8 #-----------------------------------------------------------------------
11 owner=tes@crackle.melbourne.sgi.com
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
29 # ~/attr -Fl a/b/c/d/foo
30 # Attribute "0000000000180080 0000000000000001" has a 3 byte value for a/b/c/d/foo
32 # ~/attr -Fg "0000000000180080 0000000000000001" a/b/c/d/foo
33 # Attribute "0000000000180080 0000000000000001" had a 3 byte value for a/b/c/d/foo:
36 # ~/attr -Pg "0000000000180080 0000000000000001" a/b/c/d/foo
37 # Attribute "0000000000180080 0000000000000001" had a 12 byte value for a/b/c/d/foo:
42 # filter out inode numbers to ordinal numbers
43 # (assumes they come in order)
47 find $SCRATCH_MNT -exec stat -iq {} \; >$tmp.inodes
50 -e 's/Attribute "[0-9][0-9]*/Attribute "INODE/' \
51 | nawk -v inodefile=$tmp.inodes '
54 while (getline < inodefile > 0) {
60 for (i = 1; i <= NF; i++) {
63 $nextone = inodemap[$nextone]
76 sed -e 's/inode: \([0-9][0-9]*\)/inode: N/g' \
77 -e 's/Attribute "[0-9][0-9]*/Attribute "INODE/'
81 # get standard environment, filters and checks
93 _scratch_mkfs_xfs >>$here/$seq.full 2>&1 \
94 || _fail "mkfs scratch failed"
95 _scratch_mkfs_xfs -i paths=1 >>$here/$seq.full 2>&1 \
96 || _notrun "i_paths not supported"
99 _scratch_mount >>$here/$seq.full 2>&1 \
100 || _fail "mount failed: $MOUNT_OPTIONS"
102 # real QA test starts here
107 echo "--- create some files and directories to work on ---"
114 touch dir2/dir3/file3
126 echo "--- check all is ok before we start ---"
128 xfs_check_ipaths $SCRATCH_MNT
129 xfs_repair_ipaths -n $SCRATCH_MNT
132 echo "--- now break some stuff ---"
137 echo "1. remove the EA"
140 stat_ino=`stat -iq dir2`
141 attrname=`printf "%.16x %.16x" $stat_ino $cnt`
142 #echo "attrname = $attrname"
143 attr -Fr "$attrname" dir2/file2
147 echo "2. change the EA name"
149 attr -Fl dir2/dir3/file3
151 attrname=`printf "%.16x %.16x" $stat_ino $cnt`
153 attr -Fs "$attrname" -V $attrvalue dir2/dir3/file3
154 attr -Fl dir2/dir3/file3
157 echo "3. change the EA value"
160 stat_ino=`stat -iq $d`
161 attrname=`printf "%.16x %.16x" $stat_ino $cnt`
163 attr -Fs "$attrname" -V "$attrvalue" $d/file4
165 attr -Fg "$attrname" $d/file4
168 echo "4. add an extra EA - diff name, same value"
172 attrname=`printf "%.16x %.16x" $stat_ino $cnt`
174 attr -Fs "$attrname" -V $attrvalue $d/file5
176 attr -Fg "$attrname" $d/file5
179 echo "5. add an extra EA - diff name, diff value"
183 attrname=`printf "%.16x %.16x" $stat_ino $cnt`
185 attr -Fs "$attrname" -V $attrvalue $d/file6
187 attr -Fg "$attrname" $d/file6
190 echo "6. give bad fmt'ed EA name and get rid of existing name"
194 attr -Fs "$attrname" -V $attrvalue $d/file7
195 # remove old attrname
197 stat_ino=`stat -iq $d`
198 attrname=`printf "%.16x %.16x" $stat_ino $cnt`
199 attr -Fr "$attrname" $d/file7
202 echo "--- now check it ---"
206 echo "xfs_check_ipaths"
208 xfs_check_ipaths $SCRATCH_MNT
211 echo "xfs_repair_ipaths"
213 xfs_repair_ipaths -n $SCRATCH_MNT
216 echo "--- now repair it ---"
220 echo "xfs_repair_ipaths"
222 xfs_repair_ipaths $SCRATCH_MNT
225 echo "--- now check it again ---"
230 echo "xfs_check_ipaths"
232 xfs_check_ipaths $SCRATCH_MNT
235 echo "xfs_repair_ipaths"
237 xfs_repair_ipaths -n $SCRATCH_MNT
240 _do_test 2>&1 | tee $seq.full | _filter_inodes