ext4/027: Correct the right code of block and inode bitmap
[xfstests-dev.git] / tests / ext4 / 049
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2021 Huawei.  All Rights Reserved.
4 #
5 # FS QA Test 049
6 #
7 # Regression test for kernel commit a149d2a5cabb (ext4: fix check to prevent
8 # false positive report of incorrect used inodes)
9 #
10 . ./common/preamble
11 _begin_fstest auto quick
12
13 # Import common functions.
14 . ./common/filter
15
16 # real QA test starts here
17 _supported_fs ext4
18 _require_scratch
19
20 sdev=$(_short_dev ${SCRATCH_DEV})
21 # default sleep interval
22 sleep_time=5
23
24 echo "+ create scratch fs"
25 _scratch_mkfs_ext4 -b 4096 -g 8192 -N 1024 -I 4096 >> $seqres.full 2>&1
26
27 echo "+ mount fs"
28 _scratch_mount -o errors=remount-ro
29 # The default maximum wake-up delay of the lazy init thread of ext4 is
30 # EXT4_DEF_LI_MAX_START_DELAY (5s).
31 # After mounting the file system, the lazy init thread will be awakened to
32 # perform group initialization at 0~5s after the current time. If an error
33 # is detected during the initialization process, it will be set to read-only,
34 # so the test case needs to delay a little while waiting for the init thread
35 # to execute.
36 sleep $sleep_time
37
38 echo "+ check mountpoint status"
39 cat /proc/self/mounts | grep -w ${SCRATCH_MNT} | \
40     $AWK_PROG '{print $4}' | grep -oE '^rw,' | tee -a $seqres.full
41
42 echo "+ check mountpoint writability"
43 test -w $SCRATCH_MNT || echo "scratch mount should still be writable"
44
45 echo "+ check dmesg"
46 _check_dmesg_for "\(${sdev}\): Remounting filesystem read-only" && \
47     echo "scratch dev should not be remounted to read-only"
48
49 # success, all done
50 status=0
51 exit