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
37 # skip fs check because superblock contains unknown ro-compat features
38 _require_scratch_nocheck
39 # Only V5 XFS disallow rw mount/remount with unknown ro-compat features
40 _require_scratch_xfs_crc
42 _scratch_mkfs_xfs >>$seqres.full 2>&1
44 # set the highest bit of features_ro_compat, use it as an unknown
45 # feature bit. If one day this bit become known feature, please
47 $XFS_DB_PROG -x -c "sb 0" -c "write -d features_ro_compat $((2**31))" \
48 $SCRATCH_DEV | grep -v "Allowing write of corrupted data"
50 # rw mount with unknown ro-compat feature should fail
52 _try_scratch_mount 2>>$seqres.full
54 _fail "rw mount test failed"
57 # But ro mount should succeed
59 _try_scratch_mount -o ro
61 _fail "ro mount test failed"
63 # no hang/panic is fine
64 $FSSTRESS_PROG -d $SCRATCH_MNT -p 4 -n 400 >>$seqres.full 2>&1
67 # remount as rw, kernel should reject it
68 echo "rw remount test"
69 _scratch_remount rw 2>>$seqres.full
71 dmesg | tail -n 15 >> $seqres.full
72 _fail "rw remount test failed"