4 #-----------------------------------------------------------------------
5 # Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
6 #-----------------------------------------------------------------------
9 # pv#979606: xfs bug in going from attr2 back to attr1
11 # Test bug in going from attr2 back to attr1 where xfs
12 # (due to xfs_attr_shortform_bytesfit)
13 # would reset the di_forkoff to the m_offset instead of
14 # leaving the di_forkoff alone as was intended.
16 # We create enough dirents to push us past m_attroffset,
17 # and create an EA so we have a fork offset
18 # and then turn on attr1 and add one more EA which
19 # will write over the shortform dirents.
23 owner=tes@emu.melbourne.sgi.com
26 echo "QA output created by $seq"
30 status=1 # failure is the default!
31 trap "_cleanup; exit \$status" 0 1 2 3 15
44 for i in `seq $start_num $end_num`; do
53 for i in `seq $start_num $end_num`; do
54 setfattr -n user.$i -v 0xbabe $fork_dir
62 for i in `seq $start_num $end_num`; do
63 setfattr -x user.$i $fork_dir
69 tee -a $seq.full | egrep '^u.sfdir2|^a.sfattr|core.forkoff' |\
70 egrep -v 'inumber|parent'
75 tee -a $seq.full | tr ',' '\n' | grep ATTR
81 echo "================================="
82 $XFS_DB_PROG -c "version" $SCRATCH_DEV 2>&1 | _filter_version
83 $XFS_DB_PROG -c "inode $inum" -c p $SCRATCH_DEV 2>&1 | _filter_inode
84 echo "================================="
91 if [ $1 = "-r" ]; then
92 echo "*** remove EAs start $2 end $3 ***"
95 echo "*** create EAs start $2 end $3 ***"
99 cd /; $UMOUNT_PROG $SCRATCH_MNT
105 num=`expr $2 - $1 + 1`
107 echo "*** create $num dirents ***"
110 _create_dirents $1 $2
111 cd /; $UMOUNT_PROG $SCRATCH_MNT
118 echo "Try setting attr1 by db"
120 $XFS_DB_PROG -x -c "version attr1" $SCRATCH_DEV | _filter_version
124 # get standard environment, filters and checks
128 # real QA test starts here
130 # Modify as appropriate.
136 _scratch_mkfs -i attr=2,size=512 >/dev/null 2>&1
138 # set inum to root dir ino
139 # we'll add in dirents and EAs into the root directory
140 eval `$XFS_DB_PROG -r -c 'sb 0' -c 'p rootino' $SCRATCH_DEV | $SED_PROG 's/ //g'`
142 fork_dir=$SCRATCH_MNT
145 # add enough dirents to be inline but more
146 # than will fit for m_attroffset for 512b inodes
147 # for attr2 this is not a problem
150 # add 1 ea so we get our forkoff happening
153 # now change back to attr1 where forkoff is constant now
157 # for a bug in xfs_add_shortform_bytesfit
158 # where it resets the forkoff to m_attroffset>>3 instead of
159 # leaving as di_forkoff
160 # If it resets to m_attroffset which is in the middle of
161 # the dirents then they will get corrupted