summaryrefslogtreecommitdiff
path: root/187
blob: 8086c8e342e506ccda43a5bd8195a93ac7717c71 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#! /bin/bash
# FS QA Test No. 187
#
# To test out the noattr2 flag which is broken in pv#980021
# Given an existing attr2 filesystem, we should be able to mount
# as noattr2 and go back to an attr1 filesystem.
#
# Test the case where there are no more features2 bits on and
# so the morebitsbit should be off.
#
#-----------------------------------------------------------------------
# Copyright (c) 2008 Silicon Graphics, Inc.  All Rights Reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write the Free Software Foundation,
# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#
#-----------------------------------------------------------------------
#
# creator
owner=tes@emu.melbourne.sgi.com

seq=`basename $0`
echo "QA output created by $seq"

here=`pwd`
tmp=/tmp/$$
status=1	# failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15

_cleanup()
{
    cd /
    rm -f $tmp.*
}

_filter_version()
{
	tee -a $seq.full | tr ',' '\n' | egrep 'ATTR|MORE|LAZY'
}

# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.attr

# real QA test starts here
_supported_fs xfs
_supported_os Linux

_require_scratch
_require_attrs

rm -f $seq.full

# lazysb and attr2 are in features2 and will require morebitsbit on
# So test with lazysb and without it to see if the morebitsbit is
# okay etc....
# Reset the options so that we can control what is going on here
export MKFS_OPTIONS=""
export MOUNT_OPTIONS=""

# Make sure that when we think we are testing with morebits off
# that we really are.
# Trying to future-proof in case mkfs defaults change.
_scratch_mkfs -i attr=1 -l lazy-count=0 >/dev/null 2>&1
$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 >$tmp.db
if grep -i morebits $tmp.db
then
	echo ""
	echo "Need to update test $seq so that initial subtests do not use features2"
	echo ""
	exit
fi

echo ""
echo "*** 1. test attr2 mkfs and then noattr2 mount ***"
echo ""
echo "attr2 fs"
echo ""
_scratch_mkfs -i attr=2 -l lazy-count=0 >/dev/null 2>&1
$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
echo ""
echo "noattr2 fs"
echo ""
_scratch_mount -o noattr2
$UMOUNT_PROG $SCRATCH_MNT
$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version

# adding an EA will ensure the ATTR1 flag is turned on
echo ""
echo "*** 2. test attr2 mkfs and then noattr2 mount with 1 EA ***"
echo ""
echo "attr2 fs"
echo ""
_scratch_mkfs -i attr=2 -l lazy-count=0 >/dev/null 2>&1
$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
echo ""
echo "noattr2 fs"
echo ""
_scratch_mount -o noattr2
cd $SCRATCH_MNT
touch testfile
$SETFATTR_PROG -n user.test -v 0xbabe testfile
$GETFATTR_PROG testfile
cd $here
$UMOUNT_PROG $SCRATCH_MNT
$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version

echo ""
echo "*** 3. test noattr2 mount and lazy sb ***"
echo ""
echo ""
echo "attr2 fs"
echo ""
_scratch_mkfs -i attr=2 -l lazy-count=1 >/dev/null 2>&1
$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version
echo ""
echo "noattr2 fs"
echo ""
_scratch_mount -o noattr2
cd $SCRATCH_MNT
touch testfile
cd $here
$UMOUNT_PROG $SCRATCH_MNT
$XFS_DB_PROG -c version $SCRATCH_DEV 2>&1 | _filter_version

# success, all done
status=0
exit