#! /bin/bash # SPDX-License-Identifier: GPL-2.0 # Copyright (c) 2018 Oracle. All Rights Reserved. # # FS QA Test No. 491 # # Test detection & fixing of bad summary block counts at mount time. # . ./common/preamble _begin_fstest auto quick fuzzers # Import common functions. . ./common/filter # real QA test starts here # Modify as appropriate. _supported_fs xfs _require_scratch echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 # pre-lazysbcount filesystems blindly trust the primary sb fdblocks _require_scratch_xfs_features LAZYSBCOUNT _scratch_mount >> $seqres.full 2>&1 echo "test file" > $SCRATCH_MNT/testfile echo "Fuzz fdblocks" _scratch_unmount dblocks=$(_scratch_xfs_get_metadata_field dblocks 'sb 0') _scratch_xfs_set_metadata_field fdblocks $((dblocks * 2)) 'sb 0' > $seqres.full 2>&1 echo "Detection and Correction" _scratch_mount >> $seqres.full 2>&1 avail=$(stat -c '%a' -f $SCRATCH_MNT) total=$(stat -c '%b' -f $SCRATCH_MNT) echo "avail: $avail" >> $seqres.full echo "total: $total" >> $seqres.full test "$avail" -gt "$total" && echo "free space bad: $avail > $total" # success, all done status=0 exit