2022-02-07 18:43:00

by Ritesh Harjani

[permalink] [raw]
Subject: [PATCHv1 0/4] fstests: ext4: Add fast_commit related tests

This series mainly aims at adding some of those test cases for testing
fast_commit. Kernel fix for Patch-1 is still under review [1].

RFC -> PATCHv1:
================
1. Patch-1 mostly remains the same.
2. Added ext4/057 & ext4/058 in the test bucket for fast_commit which are based
on recent kernel fixes done by Xin Yin.

[RFC]: https://lore.kernel.org/all/b834b83720f61a6aaab11fe20c48b75007be0a46.1643642943.git.riteshh@linux.ibm.com/
[1]: https://lore.kernel.org/all/53596bdf7bd7aed66020db98d903b1653a1dbc7a.1644062450.git.riteshh@linux.ibm.com/

Ritesh Harjani (4):
ext4/056: Add fast_commit regression test causing data abort exception
common/punch: Add block_size argument to _filter_fiemap_**
ext4/057: Add crash test to check unwritten extents tracking with fast_commit
ext4/058: Add shutdown recovery test with fast_commit

common/punch | 12 +++---
tests/ext4/056 | 101 +++++++++++++++++++++++++++++++++++++++++++++
tests/ext4/056.out | 3 ++
tests/ext4/057 | 62 ++++++++++++++++++++++++++++
tests/ext4/057.out | 6 +++
tests/ext4/058 | 66 +++++++++++++++++++++++++++++
tests/ext4/058.out | 7 ++++
7 files changed, 252 insertions(+), 5 deletions(-)
create mode 100755 tests/ext4/056
create mode 100644 tests/ext4/056.out
create mode 100755 tests/ext4/057
create mode 100644 tests/ext4/057.out
create mode 100755 tests/ext4/058
create mode 100644 tests/ext4/058.out

--
2.31.1



2022-02-09 08:21:59

by Ritesh Harjani

[permalink] [raw]
Subject: [PATCHv1 3/4] ext4/057: Add crash test to check unwritten extents tracking with fast_commit

fast_commit in certain cases as discussed in the corresponding kernel
commit may miss to track the unwritten extents. This patch add a test
case around that (based on test case shared in kernel commit)

5e4d0eba1ccaf19f
ext4: fix fast commit may miss tracking range for FALLOC_FL_ZERO_RANGE

Signed-off-by: Ritesh Harjani <[email protected]>
---
tests/ext4/057 | 62 ++++++++++++++++++++++++++++++++++++++++++++++
tests/ext4/057.out | 6 +++++
2 files changed, 68 insertions(+)
create mode 100755 tests/ext4/057
create mode 100644 tests/ext4/057.out

diff --git a/tests/ext4/057 b/tests/ext4/057
new file mode 100755
index 00000000..9d008b65
--- /dev/null
+++ b/tests/ext4/057
@@ -0,0 +1,62 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 IBM. All Rights Reserved.
+#
+# FS QA Test 057
+#
+# Test for ext4 fast_commit crash recovery test fixed by below kernel commit.
+#
+# commit 5e4d0eba1ccaf19f
+# ext4: fix fast commit may miss tracking range for FALLOC_FL_ZERO_RANGE
+#
+. ./common/preamble
+_begin_fstest auto quick log shutdown
+
+# Override the default cleanup function.
+_cleanup()
+{
+ cd /
+ rm -r -f $tmp.*
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/punch
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs ext4
+_require_scratch
+_require_scratch_ext4_feature "fast_commit"
+
+t1=$SCRATCH_MNT/t1
+
+$MKFS_EXT4_PROG -F -O 64bit,fast_commit $SCRATCH_DEV 512m >> $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+bs=$(_get_block_size $SCRATCH_MNT)
+
+# create and write data to t1
+$XFS_IO_PROG -f -c "pwrite 0 $((100*$bs))" $t1 | _filter_xfs_io
+
+# fsync t1
+$XFS_IO_PROG -c "fsync" $t1
+
+# fzero certain range in between
+$XFS_IO_PROG -c "fzero -k $((40*$bs)) $((20*$bs))" $t1 | _filter_xfs_io
+
+# fsync t1
+$XFS_IO_PROG -c "fsync" $t1
+
+# shutdown FS now for replay of FC to kick in next mount
+_scratch_shutdown -v >> $seqres.full 2>&1
+
+_scratch_cycle_mount
+
+# check fiemap reported is valid or not
+$XFS_IO_PROG -c "fiemap -v" $t1 | _filter_fiemap_flags $bs
+
+# success, all done
+status=0
+exit
diff --git a/tests/ext4/057.out b/tests/ext4/057.out
new file mode 100644
index 00000000..fc905de6
--- /dev/null
+++ b/tests/ext4/057.out
@@ -0,0 +1,6 @@
+QA output created by 057
+wrote 409600/409600 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+0: [0..39]: none
+1: [40..59]: unwritten
+2: [60..99]: nonelast
--
2.31.1