#! /bin/bash # SPDX-License-Identifier: GPL-2.0 # Copyright (c) 2016 Red Hat, Inc. All Rights Reserved. # # FS QA Test 270 # # Today ro-compat features can't be mounted rw, but a bug allows # an ro->rw remount transition. This bug has been fixed on linux # kernel (d0a58e8 xfs: disallow rw remount on fs with unknown # ro-compat features), and this case is the regression testcase. # seq=`basename $0` seqres=$RESULT_DIR/$seq echo "QA output created by $seq" here=`pwd` tmp=/tmp/$$ status=1 # failure is the default! trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() { cd / rm -f $tmp.* } # get standard environment, filters and checks . ./common/rc . ./common/filter # remove previous $seqres.full before test rm -f $seqres.full # real QA test starts here _supported_fs xfs # skip fs check because superblock contains unknown ro-compat features _require_scratch_nocheck # Only V5 XFS disallow rw mount/remount with unknown ro-compat features _require_scratch_xfs_crc _scratch_mkfs_xfs >>$seqres.full 2>&1 # set the highest bit of features_ro_compat, use it as an unknown # feature bit. If one day this bit become known feature, please # change this case. _scratch_xfs_set_metadata_field "features_ro_compat" "$((2**31))" "sb 0" | \ grep 'features_ro_compat' # rw mount with unknown ro-compat feature should fail echo "rw mount test" _try_scratch_mount 2>>$seqres.full if [ $? -eq 0 ]; then _fail "rw mount test failed" fi # But ro mount should succeed echo "ro mount test" _try_scratch_mount -o ro if [ $? -ne 0 ]; then _fail "ro mount test failed" else # no hang/panic is fine $FSSTRESS_PROG -d $SCRATCH_MNT -p 4 -n 400 >>$seqres.full 2>&1 fi # remount as rw, kernel should reject it echo "rw remount test" _scratch_remount rw 2>>$seqres.full if [ $? -eq 0 ]; then dmesg | tail -n 15 >> $seqres.full _fail "rw remount test failed" fi _scratch_unmount # success, all done status=0 exit