2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
7 # Exercise the XFS nosymlinks inode flag
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
18 # get standard environment, filters and checks
25 if ! _scratch_mkfs_xfs >$tmp.out 2>&1
28 echo "failed to mkfs $SCRATCH_DEV"
33 if ! _try_scratch_mount 2>/dev/null
35 echo "failed to mount $SCRATCH_DEV"
40 _filter_noymlinks_flag()
42 _test_inode_flag nosymlinks $SCRATCH_MNT/nosymlink
44 echo "--n-- SCRATCH_MNT/nosymlink"
46 echo "----- SCRATCH_MNT/nosymlink"
50 # real QA test starts here
56 echo "*** testing nosymlinks directories"
57 mkdir $SCRATCH_MNT/nosymlink
58 echo "*** setting nosymlinks bit"
59 $XFS_IO_PROG -r -c 'chattr +n' $SCRATCH_MNT/nosymlink
60 _filter_noymlinks_flag
62 touch $SCRATCH_MNT/nosymlink/source
63 ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target 2>&1 \
64 | _filter_scratch | _filter_ln
65 ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok
67 echo "*** 1st listing..."
68 find $SCRATCH_MNT | _filter_scratch
70 echo "*** clearing nosymlinks bit"
71 $XFS_IO_PROG -r -c 'chattr -n' $SCRATCH_MNT/nosymlink
72 _filter_noymlinks_flag
74 ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target
75 ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok2
77 echo "*** 2nd listing..."
78 find $SCRATCH_MNT | _filter_scratch
80 echo "*** finished testing nosymlinks directories"