2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
7 # Today ro-compat features can't be mounted rw, but a bug allows
8 # an ro->rw remount transition. This bug has been fixed on linux
9 # kernel (d0a58e8 xfs: disallow rw remount on fs with unknown
10 # ro-compat features), and this case is the regression testcase.
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
27 # get standard environment, filters and checks
31 # remove previous $seqres.full before test
34 # real QA test starts here
36 # skip fs check because superblock contains unknown ro-compat features
37 _require_scratch_nocheck
38 # Only V5 XFS disallow rw mount/remount with unknown ro-compat features
39 _require_scratch_xfs_crc
41 _scratch_mkfs_xfs >>$seqres.full 2>&1
43 # set the highest bit of features_ro_compat, use it as an unknown
44 # feature bit. If one day this bit become known feature, please
46 _scratch_xfs_set_metadata_field "features_ro_compat" "$((2**31))" "sb 0" | \
47 grep 'features_ro_compat'
49 # rw mount with unknown ro-compat feature should fail
51 _try_scratch_mount 2>>$seqres.full
53 _fail "rw mount test failed"
56 # But ro mount should succeed
58 _try_scratch_mount -o ro
60 _fail "ro mount test failed"
62 # no hang/panic is fine
63 $FSSTRESS_PROG -d $SCRATCH_MNT -p 4 -n 400 >>$seqres.full 2>&1
66 # remount as rw, kernel should reject it
67 echo "rw remount test"
68 _scratch_remount rw 2>>$seqres.full
70 dmesg | tail -n 15 >> $seqres.full
71 _fail "rw remount test failed"