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 #-----------------------------------------------------------------------
28 echo "QA output created by $seq"
32 status=1 # failure is the default!
33 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
35 # get standard environment, filters and checks
42 if ! _scratch_mkfs_xfs >$tmp.out 2>&1
45 echo "failed to mkfs $SCRATCH_DEV"
50 if ! _scratch_mount 2>/dev/null
52 echo "failed to mount $SCRATCH_DEV"
59 sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g"
64 sed -e "s,SCRATCH_MNT/nosymlink/target - Operation not permitted,ln: creating symbolic link \`SCRATCH_MNT/nosymlink/target\' to \`SCRATCH_MNT/nosymlink/source\': Operation not permitted,g" \
65 -e "/SCRATCH_MNT.*to.*SCRATCH_MNT/! s,: Operation not permitted, to \`SCRATCH_MNT/nosymlink/source\': Operation not permitted,g"
68 _filter_noymlinks_flag()
70 _test_inode_flag nosymlinks $SCRATCH_MNT/nosymlink
72 echo "--n-- SCRATCH_MNT/nosymlink"
74 echo "----- SCRATCH_MNT/nosymlink"
78 # real QA test starts here
79 _supported_os Linux IRIX
81 _require_command /usr/sbin/xfs_io
87 echo "*** testing nosymlinks directories"
88 mkdir $SCRATCH_MNT/nosymlink
89 echo "*** setting nosymlinks bit"
90 $XFS_IO_PROG -r -c 'chattr +n' $SCRATCH_MNT/nosymlink
91 _filter_noymlinks_flag
93 touch $SCRATCH_MNT/nosymlink/source
94 ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target 2>&1 \
95 | _filter_scratch | _filter_ln
96 ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok
98 echo "*** 1st listing..."
99 find $SCRATCH_MNT | _filter_scratch
101 echo "*** clearing nosymlinks bit"
102 $XFS_IO_PROG -r -c 'chattr -n' $SCRATCH_MNT/nosymlink
103 _filter_noymlinks_flag
105 ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target
106 ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok2
108 echo "*** 2nd listing..."
109 find $SCRATCH_MNT | _filter_scratch
111 echo "*** finished testing nosymlinks directories"