2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle. All Rights Reserved.
7 # Test detection & fixing of bad summary block counts at mount time.
10 _begin_fstest auto quick fuzz
12 # Import common functions.
15 # real QA test starts here
17 # Modify as appropriate.
21 echo "Format and mount"
22 _scratch_mkfs > $seqres.full 2>&1
24 # pre-lazysbcount filesystems blindly trust the primary sb fdblocks
25 _require_scratch_xfs_features LAZYSBCOUNT
27 _scratch_mount >> $seqres.full 2>&1
28 echo "test file" > $SCRATCH_MNT/testfile
32 dblocks=$(_scratch_xfs_get_metadata_field dblocks 'sb 0')
33 _scratch_xfs_set_metadata_field fdblocks $((dblocks * 2)) 'sb 0' > $seqres.full 2>&1
35 echo "Detection and Correction"
36 _scratch_mount >> $seqres.full 2>&1
37 avail=$(stat -c '%a' -f $SCRATCH_MNT)
38 total=$(stat -c '%b' -f $SCRATCH_MNT)
39 echo "avail: $avail" >> $seqres.full
40 echo "total: $total" >> $seqres.full
41 test "$avail" -gt "$total" && echo "free space bad: $avail > $total"