diff mbox series

[v2] ext4: Regression test for corruption during on-line resize

Message ID 20240917135813.1375520-1-srivathsa.d.dara@oracle.com (mailing list archive)
State New, archived
Headers show
Series [v2] ext4: Regression test for corruption during on-line resize | expand

Commit Message

Srivathsa Dara Sept. 17, 2024, 1:58 p.m. UTC
Regression test for:
	a6b3bfe176e8 ext4: fix corruption during on-line resize

Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com>
---

v1->v2:
- Remove default $MKFS_OPTIONS
- Unmount the device before running e2fsck

 tests/ext4/060     | 45 +++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/060.out |  2 ++
 2 files changed, 47 insertions(+)
 create mode 100755 tests/ext4/060
 create mode 100644 tests/ext4/060.out

Comments

Zorro Lang Sept. 19, 2024, 1:52 p.m. UTC | #1
On Tue, Sep 17, 2024 at 01:58:13PM +0000, Srivathsa Dara wrote:
> Regression test for:
> 	a6b3bfe176e8 ext4: fix corruption during on-line resize
> 
> Signed-off-by: Srivathsa Dara <srivathsa.d.dara@oracle.com>
> ---
> 
> v1->v2:
> - Remove default $MKFS_OPTIONS
> - Unmount the device before running e2fsck

This version is good to me, I'll merge it if no more review points
from ext4 list.

Reviewed-by: Zorro Lang <zlang@redhat.com>

> 
>  tests/ext4/060     | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  tests/ext4/060.out |  2 ++
>  2 files changed, 47 insertions(+)
>  create mode 100755 tests/ext4/060
>  create mode 100644 tests/ext4/060.out
> 
> diff --git a/tests/ext4/060 b/tests/ext4/060
> new file mode 100755
> index 00000000..38d1c8f7
> --- /dev/null
> +++ b/tests/ext4/060
> @@ -0,0 +1,45 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2024 Oracle.  All Rights Reserved.
> +#
> +# FS QA Test 060
> +#
> +# This test ensures that kernel avoids FS corruption while online
> +# resizing an ext4 filesystem with disabled resize_inode feature.
> +#
> +# The commit a6b3bfe176e8 ("ext4: fix corruption during on-line resize")
> +# stops the corruption.
> +#
> +
> +. ./common/preamble
> +_begin_fstest auto resize quick
> +
> +_supported_fs ext4
> +_fixed_by_kernel_commit a6b3bfe176e8 \
> +	"ext4: fix corruption during on-line resize"
> +
> +_require_command "$RESIZE2FS_PROG" resize2fs
> +_require_command "$E2FSCK_PROG" e2fsck
> +_require_scratch_size_nocheck $((9* 1024 * 1024))
> +
> +# Initialize an EXT4 filesystem with the resize_inode feature disabled,
> +# and a size of 128MiB less than 8GiB, i.e., short of 1 block group in
> +# an 8GiB filesystem.
> +
> +dev_size=$((8* 1024 * 1024 * 1024 - 128 * 1024 * 1024))
> +MKFS_OPTIONS="-O ^resize_inode" _scratch_mkfs_sized $dev_size \
> +	>>$seqres.full 2>&1
> +
> +_scratch_mount
> +
> +# Perform online-resize
> +$RESIZE2FS_PROG $SCRATCH_DEV 9G >> $seqres.full 2>&1
> +
> +_scratch_unmount
> +
> +$E2FSCK_PROG -fn $SCRATCH_DEV >> $seqres.full 2>&1 || _fail "Filesystem corrupted"
> +
> +echo "Silence is golden"
> +
> +status=0
> +exit
> diff --git a/tests/ext4/060.out b/tests/ext4/060.out
> new file mode 100644
> index 00000000..8ffce4de
> --- /dev/null
> +++ b/tests/ext4/060.out
> @@ -0,0 +1,2 @@
> +QA output created by 060
> +Silence is golden
> -- 
> 2.39.3
>
diff mbox series

Patch

diff --git a/tests/ext4/060 b/tests/ext4/060
new file mode 100755
index 00000000..38d1c8f7
--- /dev/null
+++ b/tests/ext4/060
@@ -0,0 +1,45 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2024 Oracle.  All Rights Reserved.
+#
+# FS QA Test 060
+#
+# This test ensures that kernel avoids FS corruption while online
+# resizing an ext4 filesystem with disabled resize_inode feature.
+#
+# The commit a6b3bfe176e8 ("ext4: fix corruption during on-line resize")
+# stops the corruption.
+#
+
+. ./common/preamble
+_begin_fstest auto resize quick
+
+_supported_fs ext4
+_fixed_by_kernel_commit a6b3bfe176e8 \
+	"ext4: fix corruption during on-line resize"
+
+_require_command "$RESIZE2FS_PROG" resize2fs
+_require_command "$E2FSCK_PROG" e2fsck
+_require_scratch_size_nocheck $((9* 1024 * 1024))
+
+# Initialize an EXT4 filesystem with the resize_inode feature disabled,
+# and a size of 128MiB less than 8GiB, i.e., short of 1 block group in
+# an 8GiB filesystem.
+
+dev_size=$((8* 1024 * 1024 * 1024 - 128 * 1024 * 1024))
+MKFS_OPTIONS="-O ^resize_inode" _scratch_mkfs_sized $dev_size \
+	>>$seqres.full 2>&1
+
+_scratch_mount
+
+# Perform online-resize
+$RESIZE2FS_PROG $SCRATCH_DEV 9G >> $seqres.full 2>&1
+
+_scratch_unmount
+
+$E2FSCK_PROG -fn $SCRATCH_DEV >> $seqres.full 2>&1 || _fail "Filesystem corrupted"
+
+echo "Silence is golden"
+
+status=0
+exit
diff --git a/tests/ext4/060.out b/tests/ext4/060.out
new file mode 100644
index 00000000..8ffce4de
--- /dev/null
+++ b/tests/ext4/060.out
@@ -0,0 +1,2 @@ 
+QA output created by 060
+Silence is golden