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 export MKFS_OPTIONS="$MKFS_OPTIONS -i paths=1"
96 _scratch_mkfs_xfs >>$here/$seq.full 2>&1 \
97 || _notrun "i_paths not supported"
100 _scratch_mount >>$here/$seq.full 2>&1 \
101 || _fail "mount failed: $MOUNT_OPTIONS"
103 # real QA test starts here
108 echo "--- create some files and directories to work on ---"
115 touch dir2/dir3/file3
127 echo "--- check all is ok before we start ---"
129 xfs_check_ipaths $SCRATCH_MNT
130 xfs_repair_ipaths -n $SCRATCH_MNT
133 echo "--- now break some stuff ---"
138 echo "1. remove the EA"
141 stat_ino=`stat -iq dir2`
142 attrname=`printf "%.16x %.16x" $stat_ino $cnt`
143 #echo "attrname = $attrname"
144 attr -Fr "$attrname" dir2/file2
148 echo "2. change the EA name"
150 attr -Fl dir2/dir3/file3
152 attrname=`printf "%.16x %.16x" $stat_ino $cnt`
154 attr -Fs "$attrname" -V $attrvalue dir2/dir3/file3
155 attr -Fl dir2/dir3/file3
158 echo "3. change the EA value"
161 stat_ino=`stat -iq $d`
162 attrname=`printf "%.16x %.16x" $stat_ino $cnt`
164 attr -Fs "$attrname" -V "$attrvalue" $d/file4
166 attr -Fg "$attrname" $d/file4
169 echo "4. add an extra EA - diff name, same value"
173 attrname=`printf "%.16x %.16x" $stat_ino $cnt`
175 attr -Fs "$attrname" -V $attrvalue $d/file5
177 attr -Fg "$attrname" $d/file5
180 echo "5. add an extra EA - diff name, diff value"
184 attrname=`printf "%.16x %.16x" $stat_ino $cnt`
186 attr -Fs "$attrname" -V $attrvalue $d/file6
188 attr -Fg "$attrname" $d/file6
191 echo "6. give bad fmt'ed EA name and get rid of existing name"
195 attr -Fs "$attrname" -V $attrvalue $d/file7
196 # remove old attrname
198 stat_ino=`stat -iq $d`
199 attrname=`printf "%.16x %.16x" $stat_ino $cnt`
200 attr -Fr "$attrname" $d/file7
203 echo "--- now check it ---"
207 echo "xfs_check_ipaths"
209 xfs_check_ipaths $SCRATCH_MNT
212 echo "xfs_repair_ipaths"
214 xfs_repair_ipaths -n $SCRATCH_MNT
217 echo "--- now repair it ---"
221 echo "xfs_repair_ipaths"
223 xfs_repair_ipaths $SCRATCH_MNT
226 echo "--- now check it again ---"
231 echo "xfs_check_ipaths"
233 xfs_check_ipaths $SCRATCH_MNT
236 echo "xfs_repair_ipaths"
238 xfs_repair_ipaths -n $SCRATCH_MNT
241 _do_test 2>&1 | tee $seq.full | _filter_inodes