4 # Exercise the XFS nosymlinks inode flag
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will 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 to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 # Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
24 # Mountain View, CA 94043, USA, or: http://www.sgi.com
25 #-----------------------------------------------------------------------
31 echo "QA output created by $seq"
35 status=1 # failure is the default!
36 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
38 # get standard environment, filters and checks
45 if ! _scratch_mkfs_xfs >$tmp.out 2>&1
48 echo "failed to mkfs $SCRATCH_DEV"
53 if ! _scratch_mount 2>/dev/null
55 echo "failed to mount $SCRATCH_DEV"
62 sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g"
67 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"
70 _filter_noymlinks_flag()
72 _test_inode_flag nosymlinks $SCRATCH_MNT/nosymlink
74 echo "--n-- SCRATCH_MNT/nosymlink"
76 echo "----- SCRATCH_MNT/nosymlink"
80 # real QA test starts here
81 _supported_os Linux IRIX
83 _require_command /usr/sbin/xfs_io
89 echo "*** testing nosymlinks directories"
90 mkdir $SCRATCH_MNT/nosymlink
91 echo "*** setting nosymlinks bit"
92 $XFS_IO_PROG -r -c 'chattr +n' $SCRATCH_MNT/nosymlink
93 _filter_noymlinks_flag
95 touch $SCRATCH_MNT/nosymlink/source
96 ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target 2>&1 \
97 | _filter_scratch | _filter_ln
98 ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok
100 echo "*** 1st listing..."
101 find $SCRATCH_MNT | _filter_scratch
103 echo "*** clearing nosymlinks bit"
104 $XFS_IO_PROG -r -c 'chattr -n' $SCRATCH_MNT/nosymlink
105 _filter_noymlinks_flag
107 ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target
108 ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok2
110 echo "*** 2nd listing..."
111 find $SCRATCH_MNT | _filter_scratch
113 echo "*** finished testing nosymlinks directories"