4 # Test that inline symlinks are removed from the inode when an extended
5 # attributes forces it into being remote symlink.
6 # Warning: this test will ASSERT on unpatched DEBUG XFS.
8 #-----------------------------------------------------------------------
9 # Copyright (c) 2013 SGI. All Rights Reserved.
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #-----------------------------------------------------------------------
27 seqres=$RESULT_DIR/$seq
28 echo "QA output created by $seq"
32 status=1 # failure is the default!
33 trap "_cleanup; exit \$status" 0 1 2 3 15
41 # get standard environment, filters and checks
45 # real QA test starts here
47 # Modify as appropriate. This is a XFS specific bug. xfs_db also limits
55 _scratch_mkfs_xfs >/dev/null 2>&1
57 SYMLINK_FILE="$SCRATCH_MNT/symlink"
59 SYMLINK_ADD="0123456789ABCDEF01234567890ABCDEF"
61 # test from 32 to MAXPATHLEN sized symlink. This should make sure that
62 # 256-1024 byte version 2 and 3 inodes are covered.
64 while [ $SIZE -lt 1024 ];do
65 _scratch_mount >/dev/null 2>&1
67 echo "Testing symlink size $SIZE"
68 SYMLINK="${SYMLINK}${SYMLINK_ADD}"
69 ln -s $SYMLINK $SYMLINK_FILE > /dev/null 2>&1
71 inode=`ls -li $SYMLINK_FILE | awk '{print $1}'`
72 # add the extended attributes
73 attr -Rs 1234567890ab $SYMLINK_FILE < /dev/null > /dev/null 2>&1
74 attr -Rs 1234567890ac $SYMLINK_FILE < /dev/null > /dev/null 2>&1
75 attr -Rs 1234567890ad $SYMLINK_FILE < /dev/null > /dev/null 2>&1
76 # remove the extended attributes
77 attr -Rr 1234567890ab $SYMLINK_FILE > /dev/null 2>&1
78 attr -Rr 1234567890ac $SYMLINK_FILE > /dev/null 2>&1
79 attr -Rr 1234567890ad $SYMLINK_FILE > /dev/null 2>&1
80 # remove the symlink - make sure ifree removes the remote symlink.
82 # umount and check the number of extents on the inode. Should be 0.
84 _scratch_unmount >/dev/null 2>&1
85 $XFS_DB_PROG -c "inode $inode" -c "p core.nextents" $SCRATCH_DEV