3 #-----------------------------------------------------------------------
4 # Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation.
10 # This program is distributed in the hope that it would be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #-----------------------------------------------------------------------
23 # Exercise the XFS nosymlinks inode flag
29 echo "QA output created by $seq"
33 status=1 # failure is the default!
34 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
43 if ! _scratch_mkfs_xfs >$tmp.out 2>&1
46 echo "failed to mkfs $SCRATCH_DEV"
51 if ! _scratch_mount 2>/dev/null
53 echo "failed to mount $SCRATCH_DEV"
60 sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g"
65 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" \
66 -e "/SCRATCH_MNT.*to.*SCRATCH_MNT/! s,: Operation not permitted, to \`SCRATCH_MNT/nosymlink/source\': Operation not permitted,g"
69 _filter_noymlinks_flag()
71 _test_inode_flag nosymlinks $SCRATCH_MNT/nosymlink
73 echo "--n-- SCRATCH_MNT/nosymlink"
75 echo "----- SCRATCH_MNT/nosymlink"
79 # real QA test starts here
80 _supported_os Linux IRIX
82 _require_command /usr/sbin/xfs_io
88 echo "*** testing nosymlinks directories"
89 mkdir $SCRATCH_MNT/nosymlink
90 echo "*** setting nosymlinks bit"
91 $XFS_IO_PROG -r -c 'chattr +n' $SCRATCH_MNT/nosymlink
92 _filter_noymlinks_flag
94 touch $SCRATCH_MNT/nosymlink/source
95 ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target 2>&1 \
96 | _filter_scratch | _filter_ln
97 ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok
99 echo "*** 1st listing..."
100 find $SCRATCH_MNT | _filter_scratch
102 echo "*** clearing nosymlinks bit"
103 $XFS_IO_PROG -r -c 'chattr -n' $SCRATCH_MNT/nosymlink
104 _filter_noymlinks_flag
106 ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target
107 ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok2
109 echo "*** 2nd listing..."
110 find $SCRATCH_MNT | _filter_scratch
112 echo "*** finished testing nosymlinks directories"