4 # Today ro-compat features can't be mounted rw, but a bug allows
5 # an ro->rw remount transition. This bug has been fixed on linux
6 # kernel (d0a58e8 xfs: disallow rw remount on fs with unknown
7 # ro-compat features), and this case is the regression testcase.
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
33 status=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
42 # get standard environment, filters and checks
46 # remove previous $seqres.full before test
49 # real QA test starts here
52 # skip fs check because superblock contains unknown ro-compat features
53 _require_scratch_nocheck
54 # Only V5 XFS disallow rw mount/remount with unknown ro-compat features
55 _require_scratch_xfs_crc
57 _scratch_mkfs_xfs >>$seqres.full 2>&1
59 # set the highest bit of features_ro_compat, use it as an unknown
60 # feature bit. If one day this bit become known feature, please
62 $XFS_DB_PROG -x -c "sb 0" -c "write features_ro_compat $((2**31))" $SCRATCH_DEV
64 # rw mount with unknown ro-compat feature should fail
66 _scratch_mount 2>>$seqres.full
68 _fail "rw mount test failed"
71 # But ro mount should succeed
75 _fail "ro mount test failed"
77 # no hang/panic is fine
78 $FSSTRESS_PROG -d $SCRATCH_MNT -p 4 -n 400 >>$seqres.full 2>&1
81 # remount as rw, kernel should reject it
82 echo "rw remount test"
83 _scratch_remount rw 2>>$seqres.full
85 dmesg | tail -n 15 >> $seqres.full
86 _fail "rw remount test failed"