generic: Add test to check for mounting a huge sparse dm device

Add this test to check for regression which was reported when ext4 bmap
aops was moved to use iomap APIs. jbd2 calls bmap() kernel function
from fs/inode.c which was failing since iomap_bmap() implementation earlier
returned 0 for block addr > INT_MAX.
This regression was fixed with following kernel commit [1]
commit b75dfde1212991b24b220c3995101c60a7b8ae74
("fibmap: Warn and return an error in case of block > INT_MAX")
[1]: https://patchwork.ozlabs.org/patch/1279914

w/o the kernel fix we get below errors and mount fails

[ 1461.988701] run fstests generic/613 at 2020-10-27 19:57:34
[ 1530.406645] ------------[ cut here ]------------
[ 1530.407332] would truncate bmap result
[ 1530.408956] WARNING: CPU: 0 PID: 6401 at fs/iomap/fiemap.c:116 iomap_bmap_actor+0x43/0x50
[ 1530.410607] Modules linked in:
[ 1530.411024] CPU: 0 PID: 6401 Comm: mount Tainted: G        W
<...>
[ 1530.511978] jbd2_journal_init_inode: Cannot locate journal superblock
[ 1530.513310] EXT4-fs (dm-1): Could not load journal inode

Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Ritesh Harjani
2020-12-09 09:33:41 +05:30
committed by Eryu Guan
parent 2a7406efec
commit 72dc169b44
4 changed files with 97 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2020 Christian Kujau. All Rights Reserved.
# Copyright (c) 2020 Ritesh Harjani. All Rights Reserved.
#
# FS QA Test generic/620
#
# Since the test is not specific to ext4, hence adding it to generic.
#
# Add this test to check for regression which was reported when ext4 bmap aops
# was moved to use iomap APIs. jbd2 calls bmap() kernel function from
# fs/inode.c which was failing since iomap_bmap() implementation earlier
# returned 0 for block addr > INT_MAX.
#
# This regression was fixed with following kernel commit commit b75dfde1212
# ("fibmap: Warn and return an error in case of block > INT_MAX")
#
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()
{
_dmhugedisk_cleanup
cd /
rm -f $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
. ./common/dmhugedisk
# remove previous $seqres.full before test
rm -f $seqres.full
# Modify as appropriate.
_supported_fs generic
_require_scratch_16T_support
_require_scratch_size_nocheck $((4 * 1024 * 1024)) #kB
_require_dmhugedisk
# 17TB dm huge-test-zer0 device
# (in terms of 512 sectors)
sectors=$((2*1024*1024*1024*17))
chunk_size=128
_dmhugedisk_init $sectors $chunk_size
_mkfs_dev $DMHUGEDISK_DEV
_mount $DMHUGEDISK_DEV $SCRATCH_MNT || _fail "mount failed for $DMHUGEDISK_DEV $SCRATCH_MNT"
testfile=$SCRATCH_MNT/testfile-$seq
$XFS_IO_PROG -fc "pwrite -S 0xaa 0 1m" -c "fsync" $testfile | _filter_xfs_io
# success, all done
status=0
exit
+3
View File
@@ -0,0 +1,3 @@
QA output created by 620
wrote 1048576/1048576 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+1
View File
@@ -622,3 +622,4 @@
617 auto rw io_uring stress
618 auto quick attr
619 auto rw enospc
620 auto mount quick