2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 SGI. All Rights Reserved.
7 # Test that inline symlinks are removed from the inode when an extended
8 # attributes forces it into being remote symlink.
9 # Warning: this test will ASSERT on unpatched DEBUG XFS.
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=1 # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
26 # get standard environment, filters and checks
30 # real QA test starts here
32 # Modify as appropriate. This is a XFS specific bug. xfs_db also limits
39 _scratch_mkfs_xfs >/dev/null 2>&1
41 SYMLINK_FILE="$SCRATCH_MNT/symlink"
43 SYMLINK_ADD="0123456789ABCDEF01234567890ABCDEF"
45 # test from 32 to MAXPATHLEN sized symlink. This should make sure that
46 # 256-1024 byte version 2 and 3 inodes are covered.
48 while [ $SIZE -lt 1024 ];do
49 _scratch_mount >/dev/null 2>&1
51 echo "Testing symlink size $SIZE"
52 SYMLINK="${SYMLINK}${SYMLINK_ADD}"
53 ln -s $SYMLINK $SYMLINK_FILE > /dev/null 2>&1
55 inode=`ls -li $SYMLINK_FILE | awk '{print $1}'`
56 # add the extended attributes
57 attr -Rs 1234567890ab $SYMLINK_FILE < /dev/null > /dev/null 2>&1
58 attr -Rs 1234567890ac $SYMLINK_FILE < /dev/null > /dev/null 2>&1
59 attr -Rs 1234567890ad $SYMLINK_FILE < /dev/null > /dev/null 2>&1
60 # remove the extended attributes
61 attr -Rr 1234567890ab $SYMLINK_FILE > /dev/null 2>&1
62 attr -Rr 1234567890ac $SYMLINK_FILE > /dev/null 2>&1
63 attr -Rr 1234567890ad $SYMLINK_FILE > /dev/null 2>&1
64 # remove the symlink - make sure ifree removes the remote symlink.
66 # umount and check the number of extents on the inode. Should be 0.
68 _scratch_unmount >/dev/null 2>&1
69 _scratch_xfs_db -c "inode $inode" -c "p core.nextents"