[f2fs-dev] [PATCH v3] f2fs/014: test for missing 'trimmed' flag issue
This is a regression test case to verify whether the CP_TRIMMED_FLAG is properly set after performing the following steps: 1. mount the f2fs filesystem 2. create a file, write data to it, then delete the file 3. unmount the filesystem 4. verify that the 'trimmed' flag is set in the checkpoint state We should apply the commit ("f2fs: fix missing discard for active segments") to resolve the issue where the 'trimmed' flag is missing. Signed-off-by: Chunhai Guo --- v3: - change the Copyright to VIVO - add this case to the "trim" test group - no need to check pwrite, as it is always present v2: - Skip this test case if discard is not supported. - Renumber this test case from 012 to 014. v1: https://lore.kernel.org/linux-f2fs-devel/20250521064952.1373690-1-guochun...@vivo.com/ --- tests/f2fs/014 | 40 tests/f2fs/014.out | 2 ++ 2 files changed, 42 insertions(+) create mode 100755 tests/f2fs/014 create mode 100644 tests/f2fs/014.out diff --git a/tests/f2fs/014 b/tests/f2fs/014 new file mode 100755 index ..2f2e4dc360d9 --- /dev/null +++ b/tests/f2fs/014 @@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2025 VIVO. All Rights Reserved. +# +# FS QA Test No. f2fs/014 +# +# This is a regression test case to verify whether the CP_TRIMMED_FLAG is +# properly set after performing the following steps: +# 1. mount the f2fs filesystem +# 2. create a file, write data to it, then delete the file +# 3. unmount the filesystem +# 4. verify that the 'trimmed' flag is set in the checkpoint state +# We should apply the commit ("f2fs: fix missing discard for active +# segments") to resolve the issue where the 'trimmed' flag is missing. +# +. ./common/preamble +_begin_fstest auto quick trim + +_fixed_by_kernel_commit 21263d035ff2 \ + "f2fs: fix missing discard for active segments" + +_require_scratch +_require_command "$DUMP_F2FS_PROG" dump.f2fs + +_scratch_mkfs >> $seqres.full +_scratch_mount >> $seqres.full + +_require_batched_discard $SCRATCH_MNT + +foo=$SCRATCH_MNT/foo +$XFS_IO_PROG -c "pwrite 0 1m" -c "fsync" -f $foo >> $seqres.full +sync + +rm $foo +_scratch_unmount >> $seqres.full 2>&1 + +$DUMP_F2FS_PROG $SCRATCH_DEV | grep "checkpoint state" | grep -o trimmed + +status=0 +exit diff --git a/tests/f2fs/014.out b/tests/f2fs/014.out new file mode 100644 index ..cb0c9447d675 --- /dev/null +++ b/tests/f2fs/014.out @@ -0,0 +1,2 @@ +QA output created by 014 +trimmed -- 2.34.1 ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Re: [f2fs-dev] [PATCH v2] f2fs/014: test for missing 'trimmed' flag issue
在 5/23/2025 10:32 PM, Zorro Lang 写道: > [You don't often get email from zl...@redhat.com. Learn why this is important > at https://aka.ms/LearnAboutSenderIdentification ] > > On Thu, May 22, 2025 at 01:57:06AM -0600, Chunhai Guo wrote: >> This is a regression test case to verify whether the CP_TRIMMED_FLAG is >> properly set after performing the following steps: >> 1. mount the f2fs filesystem >> 2. create a file, write data to it, then delete the file >> 3. unmount the filesystem >> 4. verify that the 'trimmed' flag is set in the checkpoint state >> >> We should apply the commit ("f2fs: fix missing discard for active >> segments") to resolve the issue where the 'trimmed' flag is missing. >> >> Signed-off-by: Chunhai Guo >> --- > This test case looks good to me, just a few picky review points as below: > >> v2: >>- Skip this test case if discard is not supported. >>- Renumber this test case from 012 to 014. >> v1: >> >> https://lore.kernel.org/linux-f2fs-devel/20250521064952.1373690-1-guochun...@vivo.com/ >> --- >> tests/f2fs/014 | 41 + >> tests/f2fs/014.out | 2 ++ >> 2 files changed, 43 insertions(+) >> create mode 100755 tests/f2fs/014 >> create mode 100644 tests/f2fs/014.out >> >> diff --git a/tests/f2fs/014 b/tests/f2fs/014 >> new file mode 100755 >> index ..f72d53e65292 >> --- /dev/null >> +++ b/tests/f2fs/014 >> @@ -0,0 +1,41 @@ >> +#! /bin/bash >> +# SPDX-License-Identifier: GPL-2.0 >> +# Copyright (c) 2025 Guo Chunhai. All Rights Reserved. > You're using a enterprise mail address -- @vivo.com, so I'm just wondering > your the Copyright should be yourself or your company? Thanks for the reminder. I'll change the Copyright to vivo in the V3 patch update. >> +# >> +# FS QA Test No. f2fs/014 >> +# >> +# This is a regression test case to verify whether the CP_TRIMMED_FLAG is >> +# properly set after performing the following steps: >> +# 1. mount the f2fs filesystem >> +# 2. create a file, write data to it, then delete the file >> +# 3. unmount the filesystem >> +# 4. verify that the 'trimmed' flag is set in the checkpoint state >> +# We should apply the commit ("f2fs: fix missing discard for active >> +# segments") to resolve the issue where the 'trimmed' flag is missing. >> +# >> +. ./common/preamble >> +_begin_fstest auto quick > Do we need to add this case to "trim" test group, as you always metion > "trimmed" in comment :) Yes, I do need to add this case to the "trim" test group. > >> + >> +_fixed_by_kernel_commit 21263d035ff2 \ >> + "f2fs: fix missing discard for active segments" >> + >> +_require_scratch >> +_require_xfs_io_command "pwrite" > This line isn't wrong, but I think you can save this line, due to the "pwrite" > is always there. > > Others look good to me, Got it. I will remove this line. Thank you for all the reminders. > > Reviewed-by: Zorro Lang > >> +_require_command "$DUMP_F2FS_PROG" dump.f2fs >> + >> +_scratch_mkfs >> $seqres.full >> +_scratch_mount >> $seqres.full >> + >> +_require_batched_discard $SCRATCH_MNT >> + >> +foo=$SCRATCH_MNT/foo >> +$XFS_IO_PROG -c "pwrite 0 1m" -c "fsync" -f $foo >> $seqres.full >> +sync >> + >> +rm $foo >> +_scratch_unmount >> $seqres.full 2>&1 >> + >> +$DUMP_F2FS_PROG $SCRATCH_DEV | grep "checkpoint state" | grep -o trimmed >> + >> +status=0 >> +exit >> diff --git a/tests/f2fs/014.out b/tests/f2fs/014.out >> new file mode 100644 >> index ..cb0c9447d675 >> --- /dev/null >> +++ b/tests/f2fs/014.out >> @@ -0,0 +1,2 @@ >> +QA output created by 014 >> +trimmed >> -- >> 2.34.1 >> >> ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Re: [f2fs-dev] [PATCH v2] mkfs.f2fs: ensure zone size is equal or bigger than segment size
On 5/24/25 00:40, Daeho Jeong wrote: > On Thu, May 22, 2025 at 7:06 PM Chao Yu wrote: >> >> On 5/23/25 02:26, Daeho Jeong wrote: >>> From: Daeho Jeong >>> >>> Otherwise, it doesn't work with a crash. >>> >>> Signed-off-by: Daeho Jeong >>> --- >>> v2: relocate the code >>> --- >>> lib/libf2fs.c | 5 + >>> 1 file changed, 5 insertions(+) >>> >>> diff --git a/lib/libf2fs.c b/lib/libf2fs.c >>> index d2579d7..148dc12 100644 >>> --- a/lib/libf2fs.c >>> +++ b/lib/libf2fs.c >>> @@ -1347,6 +1347,11 @@ int f2fs_get_f2fs_info(void) >>> } >>> c.zone_blocks = c.devices[i].zone_blocks; >>> } >>> + if (c.zone_blocks < DEFAULT_BLOCKS_PER_SEGMENT) { >> >> If c.zone_blocks can not be aligned to DEFAULT_BLOCKS_PER_SEGMENT, do we >> need to >> handle below code? > > We need to make sure that c.zone_blocks is a multiple of > DEFAULT_BLOCKS_PER_SEGMENT, right? Yes, if c.zone_blocks % DEFAULT_BLOCKS_PER_SEGMENT is true, we should fail mkfs? Thanks, > >> >> /* >> * Align sections to the device zone size and align F2FS >> zones >> * to the device zones. For F2FS_ZONED_HA model without the >> * BLKZONED feature set at format time, this is only an >> * optimization as sequential writes will not be enforced. >> */ >> c.segs_per_sec = c.zone_blocks / DEFAULT_BLOCKS_PER_SEGMENT; >> >> Thanks, >> >>> + MSG(0, "\tError: zone size should not be less " >>> + "than segment size\n"); >>> + return -1; >>> + } >>> >>> /* >>>* Align sections to the device zone size and align F2FS zones >> ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
[f2fs-dev] [syzbot] [f2fs?] kernel BUG in f2fs_invalidate_blocks (2)
Hello, syzbot found the following issue on: HEAD commit:d608703fcdd9 Merge tag 'clk-fixes-for-linus' of git://git... git tree: upstream console+strace: https://syzkaller.appspot.com/x/log.txt?x=15d1817058 kernel config: https://syzkaller.appspot.com/x/.config?x=a1de0d8596cea805 dashboard link: https://syzkaller.appspot.com/bug?extid=240643026e8cd9ddfaf2 compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=103d19f458 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=111550e858 Downloadable assets: disk image: https://storage.googleapis.com/syzbot-assets/62f880b05e70/disk-d608703f.raw.xz vmlinux: https://storage.googleapis.com/syzbot-assets/48229a0ebcc2/vmlinux-d608703f.xz kernel image: https://storage.googleapis.com/syzbot-assets/376656c50345/bzImage-d608703f.xz mounted in repro: https://storage.googleapis.com/syzbot-assets/f95e4c8e6c27/mount_0.gz fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=134279f458) IMPORTANT: if you fix the issue, please add the following tag to the commit: Reported-by: syzbot+240643026e8cd9ddf...@syzkaller.appspotmail.com syz-executor274: attempt to access beyond end of device loop0: rw=2049, sector=45096, nr_sectors = 64 limit=40427 F2FS-fs (loop0): inject inconsistent footer in sanity_check_node_footer of f2fs_get_inode_folio fs/f2fs/node.c:1547 [inline] F2FS-fs (loop0): inject inconsistent footer in sanity_check_node_footer of f2fs_get_inode_page fs/f2fs/node.c:1552 [inline] F2FS-fs (loop0): inject inconsistent footer in sanity_check_node_footer of f2fs_get_dnode_of_data+0x251/0x1c30 fs/f2fs/node.c:781 F2FS-fs (loop0): inconsistent node block, node_type:1, nid:10, node_footer[nid:10,ino:10,ofs:0,cpver:10241045589465957861,blkaddr:4615] [ cut here ] kernel BUG at fs/f2fs/segment.c:2586! Oops: invalid opcode: [#1] SMP KASAN PTI CPU: 1 UID: 0 PID: 5825 Comm: syz-executor274 Not tainted 6.15.0-rc7-syzkaller-00014-gd608703fcdd9 #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 RIP: 0010:f2fs_invalidate_blocks+0xa02/0xa10 fs/f2fs/segment.c:2586 Code: 89 d1 80 e1 07 80 c1 03 38 c1 0f 8c eb fa ff ff 48 8b 7c 24 08 e8 be c9 1a fe 48 8b 54 24 08 e9 d7 fa ff ff e8 5f f4 ba fd 90 <0f> 0b 66 66 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 RSP: 0018:c9000419f5d8 EFLAGS: 00010293 RAX: 8404fc81 RBX: 8880340fcc00 RCX: 8880332a8000 RDX: RSI: 8e53f220 RDI: RBP: 0001 R08: 8880332a8000 R09: 0003 R10: R11: R12: dc00 R13: 88806e92c000 R14: R15: FS: 846a3380() GS:8881261f6000() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: 20006000 CR3: 6ed52000 CR4: 003526f0 DR0: DR1: DR2: DR3: DR6: fffe0ff0 DR7: 0400 Call Trace: __replace_atomic_write_block+0x498/0x1240 fs/f2fs/segment.c:254 __complete_revoke_list fs/f2fs/segment.c:293 [inline] __f2fs_commit_atomic_write fs/f2fs/segment.c:385 [inline] f2fs_commit_atomic_write+0xefc/0x11b0 fs/f2fs/segment.c:403 f2fs_ioc_commit_atomic_write fs/f2fs/file.c:2318 [inline] __f2fs_ioctl+0x3f11/0xae80 fs/f2fs/file.c:4551 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:906 [inline] __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:892 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf6/0x210 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f7566ed5b59 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:7ffef05ec848 EFLAGS: 0246 ORIG_RAX: 0010 RAX: ffda RBX: RCX: 7f7566ed5b59 RDX: RSI: f502 RDI: 0004 RBP: 7f7566f4e5f0 R08: 846a44c0 R09: 846a44c0 R10: 846a44c0 R11: 0246 R12: 7ffef05ec870 R13: 7ffef05eca98 R14: 431bde82d7b634db R15: 7f7566f1e03b Modules linked in: ---[ end trace ]--- RIP: 0010:f2fs_invalidate_blocks+0xa02/0xa10 fs/f2fs/segment.c:2586 Code: 89 d1 80 e1 07 80 c1 03 38 c1 0f 8c eb fa ff ff 48 8b 7c 24 08 e8 be c9 1a fe 48 8b 54 24 08 e9 d7 fa ff ff e8 5f f4 ba fd 90 <0f> 0b 66 66 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 RSP: 0018:c9000419f5d8 EFLAGS: 00010293 RAX: 8404fc81 RBX: 8880340fcc00 RCX: 8880332a8000 RDX: RSI: 8e53f220 RDI: RBP: 0001 R08: 8880332a8000
[f2fs-dev] [syzbot] [f2fs?] KASAN: slab-out-of-bounds Read in build_sit_entries
Hello, syzbot found the following issue on: HEAD commit:176e917e010c Add linux-next specific files for 20250523 git tree: linux-next console+strace: https://syzkaller.appspot.com/x/log.txt?x=148c217058 kernel config: https://syzkaller.appspot.com/x/.config?x=e7902c752bef748 dashboard link: https://syzkaller.appspot.com/bug?extid=1fa48dc6faf1ff972d7d compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=128bead458 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=100288e858 Downloadable assets: disk image: https://storage.googleapis.com/syzbot-assets/5f7692c642fa/disk-176e917e.raw.xz vmlinux: https://storage.googleapis.com/syzbot-assets/057a442d42d0/vmlinux-176e917e.xz kernel image: https://storage.googleapis.com/syzbot-assets/8f8ebdb4dd96/bzImage-176e917e.xz mounted in repro: https://storage.googleapis.com/syzbot-assets/81e56747f56a/mount_2.gz fsck result: OK (log: https://syzkaller.appspot.com/x/fsck.log?x=138f59f458) IMPORTANT: if you fix the issue, please add the following tag to the commit: Reported-by: syzbot+1fa48dc6faf1ff972...@syzkaller.appspotmail.com loop0: detected capacity change from 0 to 262144 == BUG: KASAN: slab-out-of-bounds in sanity_check_valid_blocks fs/f2fs/segment.h:385 [inline] BUG: KASAN: slab-out-of-bounds in build_sit_entries+0x1b0c/0x1f80 fs/f2fs/segment.c:5060 Read of size 4 at addr 888024798a20 by task syz-executor138/5840 CPU: 0 UID: 0 PID: 5840 Comm: syz-executor138 Not tainted 6.15.0-rc7-next-20250523-syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0xd2/0x2b0 mm/kasan/report.c:521 kasan_report+0x118/0x150 mm/kasan/report.c:634 sanity_check_valid_blocks fs/f2fs/segment.h:385 [inline] build_sit_entries+0x1b0c/0x1f80 fs/f2fs/segment.c:5060 f2fs_build_segment_manager+0x3112/0x49f0 fs/f2fs/segment.c:5707 f2fs_fill_super+0x45bc/0x6c80 fs/f2fs/super.c:4754 mount_bdev+0x211/0x2c0 fs/super.c:1736 legacy_get_tree+0xfd/0x1a0 fs/fs_context.c:666 vfs_get_tree+0x92/0x2b0 fs/super.c:1802 do_new_mount+0x24a/0xa40 fs/namespace.c:3869 do_mount fs/namespace.c:4206 [inline] __do_sys_mount fs/namespace.c:4417 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4394 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff3b36f7e6a Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:7ffc20c3a528 EFLAGS: 0286 ORIG_RAX: 00a5 RAX: ffda RBX: 7ffc20c3a540 RCX: 7ff3b36f7e6a RDX: 20020440 RSI: 20020480 RDI: 7ffc20c3a540 RBP: 20020480 R08: 7ffc20c3a580 R09: 00020419 R10: R11: 0286 R12: 20020440 R13: 7ffc20c3a580 R14: 0003 R15: Allocated by task 5840: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __do_kmalloc_node mm/slub.c:4327 [inline] __kvmalloc_node_noprof+0x30d/0x5f0 mm/slub.c:5014 f2fs_kvmalloc fs/f2fs/f2fs.h:3527 [inline] f2fs_kvzalloc fs/f2fs/f2fs.h:3533 [inline] build_sit_info fs/f2fs/segment.c:4779 [inline] f2fs_build_segment_manager+0x1485/0x49f0 fs/f2fs/segment.c:5696 f2fs_fill_super+0x45bc/0x6c80 fs/f2fs/super.c:4754 mount_bdev+0x211/0x2c0 fs/super.c:1736 legacy_get_tree+0xfd/0x1a0 fs/fs_context.c:666 vfs_get_tree+0x92/0x2b0 fs/super.c:1802 do_new_mount+0x24a/0xa40 fs/namespace.c:3869 do_mount fs/namespace.c:4206 [inline] __do_sys_mount fs/namespace.c:4417 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4394 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at 888024798000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 0 bytes to the right of allocated 2592-byte region [888024798000, 888024798a20) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping: index:0x0 pfn:0x24798 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff040 88801a442140 dead0
Re: [f2fs-dev] [syzbot] [f2fs?] KASAN: slab-out-of-bounds Read in build_sit_entries
syzbot has bisected this issue to: commit 313d10d79a82358bd8c3ee7ecda6356b1f7cde55 Author: yohan.joung Date: Mon May 12 07:36:10 2025 + f2fs: add ckpt_valid_blocks to the section entry bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1300d17058 start commit: 176e917e010c Add linux-next specific files for 20250523 git tree: linux-next final oops: https://syzkaller.appspot.com/x/report.txt?x=1080d17058 console output: https://syzkaller.appspot.com/x/log.txt?x=1700d17058 kernel config: https://syzkaller.appspot.com/x/.config?x=e7902c752bef748 dashboard link: https://syzkaller.appspot.com/bug?extid=1fa48dc6faf1ff972d7d syz repro: https://syzkaller.appspot.com/x/repro.syz?x=128bead458 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=100288e858 Reported-by: syzbot+1fa48dc6faf1ff972...@syzkaller.appspotmail.com Fixes: 313d10d79a82 ("f2fs: add ckpt_valid_blocks to the section entry") For information about bisection process see: https://goo.gl/tpsmEJ#bisection ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Re: [f2fs-dev] [GIT PULL] fscrypt update for 6.16
The pull request you sent on Sun, 25 May 2025 18:11:59 -0700: > https://git.kernel.org/pub/scm/fs/fscrypt/linux.git tags/fscrypt-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/14f19dc6440f23f417c83207c117b54698aa3934 Thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel