2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
7 # To test out the noattr2 flag which is broken in pv#980021
8 # Given an existing attr2 filesystem, we should be able to mount
9 # as noattr2 and go back to an attr1 filesystem.
11 # Test the case where there are no more features2 bits on and
12 # so the morebitsbit should be off.
15 _begin_fstest attr auto quick
19 tee -a $seqres.full | tr ',' '\n' | egrep 'ATTR|MORE|LAZY'
22 # Import common functions.
26 # real QA test starts here
34 # Reset the options so that we can control what is going on here
35 export MKFS_OPTIONS=""
36 export MOUNT_OPTIONS=""
38 # lazysb, attr2 and other feature bits are held in features2 and will require
39 # morebitsbit on So test with lazysb and without it to see if the morebitsbit is
40 # okay etc. If the mkfs defaults change, these need to change as well.
41 MKFS_NO_LAZY="-m crc=0 -l lazy-count=0 -i projid32bit=0"
42 MKFS_LAZY="-m crc=0 -l lazy-count=1 -i projid32bit=0"
44 # ftype is also stored in features2, so we have to detect its presence in
45 # mkfs and disable it here too.
46 if _scratch_mkfs --help 2>&1 | grep -q "ftype="; then
47 MKFS_NO_LAZY="$MKFS_NO_LAZY -n ftype=0"
48 MKFS_LAZY="$MKFS_LAZY -n ftype=0"
51 # Make sure that when we think we are testing with morebits off
53 _scratch_mkfs -i attr=1 $MKFS_NO_LAZY >/dev/null 2>&1
54 _scratch_xfs_db -c version 2>&1 >$tmp.db
55 if grep -i morebits $tmp.db
58 echo "Need to update test $seq so that initial subtests do not use features2"
64 echo "*** 1. test attr2 mkfs and then noattr2 mount ***"
68 _scratch_mkfs -i attr=2 $MKFS_NO_LAZY >/dev/null 2>&1
69 _scratch_xfs_db -r -c version 2>&1 | _filter_version
73 _scratch_mount -o noattr2
74 $UMOUNT_PROG $SCRATCH_MNT
75 _scratch_xfs_db -r -c version 2>&1 | _filter_version
77 # adding an EA will ensure the ATTR1 flag is turned on
79 echo "*** 2. test attr2 mkfs and then noattr2 mount with 1 EA ***"
83 _scratch_mkfs -i attr=2 $MKFS_NO_LAZY >/dev/null 2>&1
84 _scratch_xfs_db -r -c version 2>&1 | _filter_version
88 _scratch_mount -o noattr2
91 $SETFATTR_PROG -n user.test -v 0xbabe testfile
94 $UMOUNT_PROG $SCRATCH_MNT
95 _scratch_xfs_db -r -c version 2>&1 | _filter_version
98 echo "*** 3. test noattr2 mount and lazy sb ***"
103 _scratch_mkfs -i attr=2 $MKFS_LAZY >/dev/null 2>&1
104 _scratch_xfs_db -r -c version 2>&1 | _filter_version
108 _scratch_mount -o noattr2
112 $UMOUNT_PROG $SCRATCH_MNT
113 _scratch_xfs_db -r -c version 2>&1 | _filter_version