2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2021 Huawei. All Rights Reserved.
7 # Regression test for kernel commit a149d2a5cabb (ext4: fix check to prevent
8 # false positive report of incorrect used inodes)
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
25 # get standard environment, filters and checks
29 # remove previous $seqres.full before test
32 # real QA test starts here
36 sdev=$(_short_dev ${SCRATCH_DEV})
37 # default sleep interval
40 echo "+ create scratch fs"
41 _scratch_mkfs_ext4 -b 4096 -g 8192 -N 1024 -I 4096 >> $seqres.full 2>&1
44 _scratch_mount -o errors=remount-ro
45 # The default maximum wake-up delay of the lazy init thread of ext4 is
46 # EXT4_DEF_LI_MAX_START_DELAY (5s).
47 # After mounting the file system, the lazy init thread will be awakened to
48 # perform group initialization at 0~5s after the current time. If an error
49 # is detected during the initialization process, it will be set to read-only,
50 # so the test case needs to delay a little while waiting for the init thread
54 echo "+ check mountpoint status"
55 cat /proc/self/mounts | grep -w ${SCRATCH_MNT} | \
56 $AWK_PROG '{print $4}' | grep -oE '^rw,' | tee -a $seqres.full
58 echo "+ check mountpoint writability"
59 test -w $SCRATCH_MNT || echo "scratch mount should still be writable"
62 _check_dmesg_for "\(${sdev}\): Remounting filesystem read-only" && \
63 echo "scratch dev should not be remounted to read-only"