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 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
20 status=1 # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
31 tee -a $seqres.full | tr ',' '\n' | egrep 'ATTR|MORE|LAZY'
34 # get standard environment, filters and checks
39 # real QA test starts here
49 # Reset the options so that we can control what is going on here
50 export MKFS_OPTIONS=""
51 export MOUNT_OPTIONS=""
53 # lazysb, attr2 and other feature bits are held in features2 and will require
54 # morebitsbit on So test with lazysb and without it to see if the morebitsbit is
55 # okay etc. If the mkfs defaults change, these need to change as well.
56 MKFS_NO_LAZY="-m crc=0 -l lazy-count=0 -i projid32bit=0"
57 MKFS_LAZY="-m crc=0 -l lazy-count=1 -i projid32bit=0"
59 # ftype is also stored in features2, so we have to detect its presence in
60 # mkfs and disable it here too.
61 if _scratch_mkfs --help 2>&1 | grep -q "ftype="; then
62 MKFS_NO_LAZY="$MKFS_NO_LAZY -n ftype=0"
63 MKFS_LAZY="$MKFS_LAZY -n ftype=0"
66 # Make sure that when we think we are testing with morebits off
68 _scratch_mkfs -i attr=1 $MKFS_NO_LAZY >/dev/null 2>&1
69 _scratch_xfs_db -c version 2>&1 >$tmp.db
70 if grep -i morebits $tmp.db
73 echo "Need to update test $seq so that initial subtests do not use features2"
79 echo "*** 1. test attr2 mkfs and then noattr2 mount ***"
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
89 $UMOUNT_PROG $SCRATCH_MNT
90 _scratch_xfs_db -r -c version 2>&1 | _filter_version
92 # adding an EA will ensure the ATTR1 flag is turned on
94 echo "*** 2. test attr2 mkfs and then noattr2 mount with 1 EA ***"
98 _scratch_mkfs -i attr=2 $MKFS_NO_LAZY >/dev/null 2>&1
99 _scratch_xfs_db -r -c version 2>&1 | _filter_version
103 _scratch_mount -o noattr2
106 $SETFATTR_PROG -n user.test -v 0xbabe testfile
109 $UMOUNT_PROG $SCRATCH_MNT
110 _scratch_xfs_db -r -c version 2>&1 | _filter_version
113 echo "*** 3. test noattr2 mount and lazy sb ***"
118 _scratch_mkfs -i attr=2 $MKFS_LAZY >/dev/null 2>&1
119 _scratch_xfs_db -r -c version 2>&1 | _filter_version
123 _scratch_mount -o noattr2
127 $UMOUNT_PROG $SCRATCH_MNT
128 _scratch_xfs_db -r -c version 2>&1 | _filter_version