* [PATCH 1/2] common/config: export F2FS_RESIZE_PROG
@ 2026-03-19 3:35 Yangyang Zang
2026-03-19 3:35 ` [PATCH 2/2] f2fs/024: add testcase to check resize corrupting root inode Yangyang Zang
2026-03-23 9:22 ` [PATCH 1/2] common/config: export F2FS_RESIZE_PROG Chao Yu
0 siblings, 2 replies; 4+ messages in thread
From: Yangyang Zang @ 2026-03-19 3:35 UTC (permalink / raw)
To: zlang; +Cc: fstests, linux-f2fs-devel, Yangyang Zang, Jaegeuk Kim, Chao Yu
export F2FS_RESIZE_PROG w/ resize.f2fs, it can be used for resize f2fs.
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Chao Yu <chao@kernel.org>
Signed-off-by: Yangyang Zang <zangyangyang1@xiaomi.com>
---
common/config | 1 +
1 file changed, 1 insertion(+)
diff --git a/common/config b/common/config
index 1420e35ddfee..d95b3226e85f 100644
--- a/common/config
+++ b/common/config
@@ -309,6 +309,7 @@ export DUMP_F2FS_PROG=$(type -P dump.f2fs)
export F2FS_IO_PROG=$(type -P f2fs_io)
export F2FS_INJECT_PROG=$(type -P inject.f2fs)
export F2FS_FSCK_PROG=$(type -P fsck.f2fs)
+export F2FS_RESIZE_PROG=$(type -P resize.f2fs)
export BTRFS_UTIL_PROG=$(type -P btrfs)
export BTRFS_SHOW_SUPER_PROG=$(type -P btrfs-show-super)
export BTRFS_CONVERT_PROG=$(type -P btrfs-convert)
--
2.43.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] f2fs/024: add testcase to check resize corrupting root inode
2026-03-19 3:35 [PATCH 1/2] common/config: export F2FS_RESIZE_PROG Yangyang Zang
@ 2026-03-19 3:35 ` Yangyang Zang
2026-03-23 9:35 ` Chao Yu
2026-03-23 9:22 ` [PATCH 1/2] common/config: export F2FS_RESIZE_PROG Chao Yu
1 sibling, 1 reply; 4+ messages in thread
From: Yangyang Zang @ 2026-03-19 3:35 UTC (permalink / raw)
To: zlang; +Cc: fstests, linux-f2fs-devel, Yangyang Zang, Jaegeuk Kim, Chao Yu
This is a regression test to check whether the f2fs root inode
is corrupted after the resize operation.
During the resize operation, SSA data blocks are migrated and
zeroed. This process may incorrectly zero out the main area
blocks, leading to root inode corruption.
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Chao Yu <chao@kernel.org>
Signed-off-by: Yangyang Zang <zangyangyang1@xiaomi.com>
---
tests/f2fs/024 | 39 +++++++++++++++++++++++++++++++++++++++
tests/f2fs/024.out | 7 +++++++
2 files changed, 46 insertions(+)
create mode 100644 tests/f2fs/024
create mode 100644 tests/f2fs/024.out
diff --git a/tests/f2fs/024 b/tests/f2fs/024
new file mode 100644
index 000000000000..1ca7ee27c18b
--- /dev/null
+++ b/tests/f2fs/024
@@ -0,0 +1,39 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2026 Yangyang Zang. All Rights Reserved.
+#
+# FS QA Test No. f2fs/024
+#
+# This test case tries to check whether resize.f2fs can correctly
+# zero out ssa blocks without corrupting the main area blocks.
+#
+. ./common/preamble
+_begin_fstest auto quick
+
+_fixed_by_git_commit f2fs-tools xxxxxxxxxxxx \
+ "resize.f2fs: fix to avoid zeroing main area blocks in migrate_ssa()"
+
+# magic size
+target_fs_size=$((2*1024*1024*1024+4*1024*1204))
+
+_require_scratch_size_nocheck $(($target_fs_size/1024))
+_require_command "$F2FS_RESIZE_PROG" resize.f2fs
+_require_command "$DUMP_F2FS_PROG" dump.f2fs
+
+# remove all mkfs options to avoid layout change of on-disk inode
+export MKFS_OPTIONS=""
+
+_scratch_mkfs_sized $((512*1024*1024)) "" "-g android" >> $seqres.full
+
+sector_size=$(blockdev --getss $SCRATCH_DEV)
+target_sectors=$(($target_fs_size/$sector_size))
+
+$F2FS_RESIZE_PROG -F $SCRATCH_DEV -t $target_sectors >> $seqres.full 2>&1 || \
+ $F2FS_RESIZE_PROG $SCRATCH_DEV -t $target_sectors >> $seqres.full 2>&1 || \
+ _fail "resize fs failed"
+
+echo n | $DUMP_F2FS_PROG -d 1 -i 3 $SCRATCH_DEV | grep "dump_node:" | sed 's/^\[[^]]*\] //'
+_scratch_mount
+
+status=0
+exit
diff --git a/tests/f2fs/024.out b/tests/f2fs/024.out
new file mode 100644
index 000000000000..a7a553f0681b
--- /dev/null
+++ b/tests/f2fs/024.out
@@ -0,0 +1,7 @@
+QA output created by 024
+Node ID [0x3]
+nat_entry.block_addr [0x1a00]
+nat_entry.version [0x0]
+nat_entry.ino [0x3]
+node_blk.footer.ino [0x3]
+node_blk.footer.nid [0x3]
--
2.43.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] common/config: export F2FS_RESIZE_PROG
2026-03-19 3:35 [PATCH 1/2] common/config: export F2FS_RESIZE_PROG Yangyang Zang
2026-03-19 3:35 ` [PATCH 2/2] f2fs/024: add testcase to check resize corrupting root inode Yangyang Zang
@ 2026-03-23 9:22 ` Chao Yu
1 sibling, 0 replies; 4+ messages in thread
From: Chao Yu @ 2026-03-23 9:22 UTC (permalink / raw)
To: Yangyang Zang, zlang
Cc: chao, fstests, linux-f2fs-devel, Yangyang Zang, Jaegeuk Kim
On 3/19/26 11:35, Yangyang Zang wrote:
> export F2FS_RESIZE_PROG w/ resize.f2fs, it can be used for resize f2fs.
>
> Cc: Jaegeuk Kim <jaegeuk@kernel.org>
> Cc: Chao Yu <chao@kernel.org>
> Signed-off-by: Yangyang Zang <zangyangyang1@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] f2fs/024: add testcase to check resize corrupting root inode
2026-03-19 3:35 ` [PATCH 2/2] f2fs/024: add testcase to check resize corrupting root inode Yangyang Zang
@ 2026-03-23 9:35 ` Chao Yu
0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2026-03-23 9:35 UTC (permalink / raw)
To: Yangyang Zang, zlang
Cc: chao, fstests, linux-f2fs-devel, Yangyang Zang, Jaegeuk Kim
On 3/19/26 11:35, Yangyang Zang wrote:
> This is a regression test to check whether the f2fs root inode
> is corrupted after the resize operation.
> During the resize operation, SSA data blocks are migrated and
> zeroed. This process may incorrectly zero out the main area
> blocks, leading to root inode corruption.
>
> Cc: Jaegeuk Kim <jaegeuk@kernel.org>
> Cc: Chao Yu <chao@kernel.org>
> Signed-off-by: Yangyang Zang <zangyangyang1@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-23 9:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 3:35 [PATCH 1/2] common/config: export F2FS_RESIZE_PROG Yangyang Zang
2026-03-19 3:35 ` [PATCH 2/2] f2fs/024: add testcase to check resize corrupting root inode Yangyang Zang
2026-03-23 9:35 ` Chao Yu
2026-03-23 9:22 ` [PATCH 1/2] common/config: export F2FS_RESIZE_PROG Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox