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
57 echo "*** testing nosymlinks directories"
58 mkdir $SCRATCH_MNT/nosymlink
59 echo "*** setting nosymlinks bit"
60 $XFS_IO_PROG -r -c 'chattr +n' $SCRATCH_MNT/nosymlink
61 _filter_noymlinks_flag
63 touch $SCRATCH_MNT/nosymlink/source
64 ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target 2>&1 \
65 | _filter_scratch | _filter_ln
66 ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok
68 echo "*** 1st listing..."
69 find $SCRATCH_MNT | _filter_scratch
71 echo "*** clearing nosymlinks bit"
72 $XFS_IO_PROG -r -c 'chattr -n' $SCRATCH_MNT/nosymlink
73 _filter_noymlinks_flag
75 ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target
76 ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok2
78 echo "*** 2nd listing..."
79 find $SCRATCH_MNT | _filter_scratch
81 echo "*** finished testing nosymlinks directories"