blob: a3f0ef9e6a40cb0ec339f6df94bf2744a5aaf758 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
#
# FS QA Test No. 103
#
# Exercise the XFS nosymlinks inode flag
#
. ./common/preamble
_begin_fstest metadata dir ioctl auto quick
# Import common functions.
. ./common/filter
_create_scratch()
{
echo "*** mkfs"
if ! _scratch_mkfs_xfs >$tmp.out 2>&1
then
cat $tmp.out
echo "failed to mkfs $SCRATCH_DEV"
exit 1
fi
echo "*** mount"
if ! _try_scratch_mount 2>/dev/null
then
echo "failed to mount $SCRATCH_DEV"
exit 1
fi
}
_filter_noymlinks_flag()
{
_test_inode_flag nosymlinks $SCRATCH_MNT/nosymlink
if [ $? -eq 0 ]; then
echo "--n-- SCRATCH_MNT/nosymlink"
else
echo "----- SCRATCH_MNT/nosymlink"
fi
}
# real QA test starts here
_supported_fs xfs
_require_scratch
_create_scratch
echo "*** testing nosymlinks directories"
mkdir $SCRATCH_MNT/nosymlink
echo "*** setting nosymlinks bit"
$XFS_IO_PROG -r -c 'chattr +n' $SCRATCH_MNT/nosymlink
_filter_noymlinks_flag
touch $SCRATCH_MNT/nosymlink/source
ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target 2>&1 \
| _filter_scratch | _filter_ln
ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok
echo "*** 1st listing..."
find $SCRATCH_MNT | _filter_scratch
echo "*** clearing nosymlinks bit"
$XFS_IO_PROG -r -c 'chattr -n' $SCRATCH_MNT/nosymlink
_filter_noymlinks_flag
ln -s $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/target
ln $SCRATCH_MNT/nosymlink/source $SCRATCH_MNT/nosymlink/hardlinksareok2
echo "*** 2nd listing..."
find $SCRATCH_MNT | _filter_scratch
echo "*** finished testing nosymlinks directories"
status=0
exit
|