Skip to contentSkip to conversation

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

PATCH New Ritesh Harjani 1 participant 1 message Dec 9, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 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

---
v2->v3: Addressed review comments from Eryu [1]
[1]: https://patchwork.kernel.org/patch/11951463

 common/rc             | 31 ++++++++++++++++++++++
 tests/generic/620     | 62 +++++++++++++++++++++++++++++++++++++++++++
 tests/generic/620.out |  3 +++
 tests/generic/group   |  1 +
 4 files changed, 97 insertions(+)
 create mode 100755 tests/generic/620
 create mode 100644 tests/generic/620.out
common/rc +31 -0
index 5911a6c89a78..33b5b598a198 100644
@@ -1608,6 +1608,37 @@ _require_scratch_size()
 	[ $devsize -lt $1 ] && _notrun "scratch dev too small"
 }
 
+# require a scratch dev of a minimum size (in kb) and should not be checked
+# post test
+_require_scratch_size_nocheck()
+{
+	[ $# -eq 1 ] || _fail "_require_scratch_size: expected size param"
+
+	_require_scratch_nocheck
+	local devsize=`_get_device_size $SCRATCH_DEV`
+	[ $devsize -lt $1 ] && _notrun "scratch dev too small"
+}
+
+# require scratch fs which supports >16T of filesystem size.
+_require_scratch_16T_support()
+{
+	case $FSTYP in
+	ext2|ext3|f2fs)
+		_notrun "$FSTYP doesn't support >16T filesystem"
+		;;
+	ext4)
+		_scratch_mkfs >> $seqres.full 2>&1
+		_scratch_mount
+		local blocksize=$(_get_block_size $SCRATCH_MNT)
+		if [ $blocksize -lt 4096 ]; then
+			_notrun "This test requires >16T fs support"
+		fi
+		_scratch_unmount
+		;;
+	*)
+		;;
+	esac
+}
 
 # this test needs a test partition - check we're ok & mount it
 #
tests/generic/620 new file +62 -0

62 lines not on this page · raw message

tests/generic/620.out new file +3 -0
new file mode 100644
index 000000000000..9a51e9e2cb8c
@@ -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)
tests/generic/group +1 -0
index 15a2f40e2520..d8758d7f6a5f 100644
@@ -622,3 +622,4 @@
 617 auto rw io_uring stress
 618 auto quick attr
 619 auto rw enospc
+620 auto mount quick

--
2.26.2