5 # pv#979606: xfs bug in going from attr2 back to attr1
7 # Test bug in going from attr2 back to attr1 where xfs
8 # (due to xfs_attr_shortform_bytesfit)
9 # would reset the di_forkoff to the m_offset instead of
10 # leaving the di_forkoff alone as was intended.
12 # We create enough dirents to push us past m_attroffset,
13 # and create an EA so we have a fork offset
14 # and then turn on attr1 and add one more EA which
15 # will write over the shortform dirents.
17 #-----------------------------------------------------------------------
18 # Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
20 # This program is free software; you can redistribute it and/or
21 # modify it under the terms of the GNU General Public License as
22 # published by the Free Software Foundation.
24 # This program is distributed in the hope that it would be useful,
25 # but WITHOUT ANY WARRANTY; without even the implied warranty of
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 # GNU General Public License for more details.
29 # You should have received a copy of the GNU General Public License
30 # along with this program; if not, write the Free Software Foundation,
31 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
33 #-----------------------------------------------------------------------
36 owner=tes@emu.melbourne.sgi.com
39 echo "QA output created by $seq"
43 status=1 # failure is the default!
44 trap "_cleanup; exit \$status" 0 1 2 3 15
57 for i in `seq $start_num $end_num`; do
66 for i in `seq $start_num $end_num`; do
67 $SETFATTR_PROG -n user.$i -v 0xbabe $fork_dir
75 for i in `seq $start_num $end_num`; do
76 $SETFATTR_PROG -x user.$i $fork_dir
82 tee -a $here/$seq.full | \
83 sed -e "s/core.forkoff/forkoff/g" | \
84 egrep '^u.sfdir2|^a.sfattr|forkoff' | \
85 egrep -v 'inumber|parent'
90 tee -a $here/$seq.full | tr ',' '\n' | grep ATTR
96 echo "================================="
97 $XFS_DB_PROG -c "version" $SCRATCH_DEV 2>&1 | _filter_version
98 $XFS_DB_PROG -c "inode $inum" -c p $SCRATCH_DEV 2>&1 | _filter_inode
99 echo "================================="
106 if [ $1 = "-r" ]; then
107 echo "*** remove EAs start $2 end $3 ***"
110 echo "*** create EAs start $2 end $3 ***"
114 cd /; $UMOUNT_PROG $SCRATCH_MNT
120 num=`expr $2 - $1 + 1`
122 echo "*** create $num dirents ***"
125 _create_dirents $1 $2
126 cd /; $UMOUNT_PROG $SCRATCH_MNT
133 echo "Try setting attr1 by db"
135 $XFS_DB_PROG -x -c "version attr1" $SCRATCH_DEV | _filter_version
139 # get standard environment, filters and checks
143 # real QA test starts here
145 # Modify as appropriate.
151 _scratch_mkfs -i attr=2,size=512 -l lazy-count=1 >/dev/null 2>&1
153 # set inum to root dir ino
154 # we'll add in dirents and EAs into the root directory
155 eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' $SCRATCH_DEV | $SED_PROG 's/ //g'`
157 fork_dir=$SCRATCH_MNT
160 # add enough dirents to be inline but more
161 # than will fit for m_attroffset for 512b inodes
162 # for attr2 this is not a problem
165 # add 1 ea so we get our forkoff happening
168 # now change back to attr1 where forkoff is constant now
172 # for a bug in xfs_add_shortform_bytesfit
173 # where it resets the forkoff to m_attroffset>>3 instead of
174 # leaving as di_forkoff
175 # If it resets to m_attroffset which is in the middle of
176 # the dirents then they will get corrupted