4 # Exercise the XFS nosymlinks inode flag
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
31 status=1 # failure is the default!
32 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
34 # get standard environment, filters and checks
41 if ! _scratch_mkfs_xfs >$tmp.out 2>&1
44 echo "failed to mkfs $SCRATCH_DEV"
49 if ! _scratch_mount 2>/dev/null
51 echo "failed to mount $SCRATCH_DEV"
56 _filter_noymlinks_flag()
58 _test_inode_flag nosymlinks $SCRATCH_MNT/nosymlink
60 echo "--n-- SCRATCH_MNT/nosymlink"
62 echo "----- SCRATCH_MNT/nosymlink"
66 # real QA test starts here
67 _supported_os Linux IRIX
69 _require_command $XFS_IO_PROG xfs_io
74 echo "*** testing nosymlinks directories"
75 mkdir $SCRATCH_MNT/nosymlink
76 echo "*** setting nosymlinks bit"
77 $XFS_IO_PROG -r -c 'chattr +n' $SCRATCH_MNT/nosymlink
78 _filter_noymlinks_flag
80 touch $SCRATCH_MNT/nosymlink/source
81 ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target 2>&1 \
82 | _filter_scratch | _filter_ln
83 ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok
85 echo "*** 1st listing..."
86 find $SCRATCH_MNT | _filter_scratch
88 echo "*** clearing nosymlinks bit"
89 $XFS_IO_PROG -r -c 'chattr -n' $SCRATCH_MNT/nosymlink
90 _filter_noymlinks_flag
92 ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target
93 ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok2
95 echo "*** 2nd listing..."
96 find $SCRATCH_MNT | _filter_scratch
98 echo "*** finished testing nosymlinks directories"