linux-yocto/fs/f2fs
Chao Yu 385e64a074 f2fs: fix to trigger foreground gc during f2fs_map_blocks() in lfs mode
[ Upstream commit 1005a3ca28 ]

w/ "mode=lfs" mount option, generic/299 will cause system panic as below:

------------[ cut here ]------------
kernel BUG at fs/f2fs/segment.c:2835!
Call Trace:
 <TASK>
 f2fs_allocate_data_block+0x6f4/0xc50
 f2fs_map_blocks+0x970/0x1550
 f2fs_iomap_begin+0xb2/0x1e0
 iomap_iter+0x1d6/0x430
 __iomap_dio_rw+0x208/0x9a0
 f2fs_file_write_iter+0x6b3/0xfa0
 aio_write+0x15d/0x2e0
 io_submit_one+0x55e/0xab0
 __x64_sys_io_submit+0xa5/0x230
 do_syscall_64+0x84/0x2f0
 entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0010:new_curseg+0x70f/0x720

The root cause of we run out-of-space is: in f2fs_map_blocks(), f2fs may
trigger foreground gc only if it allocates any physical block, it will be
a little bit later when there is multiple threads writing data w/
aio/dio/bufio method in parallel, since we always use OPU in lfs mode, so
f2fs_map_blocks() does block allocations aggressively.

In order to fix this issue, let's give a chance to trigger foreground
gc in prior to block allocation in f2fs_map_blocks().

Fixes: 36abef4e79 ("f2fs: introduce mode=lfs mount option")
Cc: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-15 16:39:19 +02:00
..
acl.c f2fs: Pass a folio to f2fs_getxattr() 2025-04-28 15:26:42 +00:00
acl.h f2fs: Pass folios to f2fs_init_acl() 2025-04-28 15:26:41 +00:00
checkpoint.c f2fs: introduce is_{meta,node}_folio 2025-05-28 16:03:26 +00:00
compress.c f2fs: compress: fix UAF of f2fs_inode_info in f2fs_free_dic 2025-08-15 16:39:18 +02:00
data.c f2fs: fix to trigger foreground gc during f2fs_map_blocks() in lfs mode 2025-08-15 16:39:19 +02:00
debug.c f2fs: fix to avoid invalid wait context issue 2025-08-15 16:39:18 +02:00
dir.c f2fs: Pass a folio to f2fs_update_inode() 2025-04-28 15:26:47 +00:00
extent_cache.c f2fs: fix KMSAN uninit-value in extent_info usage 2025-08-15 16:39:18 +02:00
f2fs.h f2fs: fix to avoid out-of-boundary access in devs.path 2025-08-15 16:39:19 +02:00
file.c f2fs: fix to zero post-eof page 2025-06-18 21:35:29 +00:00
gc.c f2fs: turn off one_time when forcibly set to foreground GC 2025-08-15 16:39:17 +02:00
gc.h f2fs: decrease spare area for pinned files for zoned devices 2024-11-01 01:19:00 +00:00
hash.c
inline.c f2fs: drop usage of folio_index 2025-05-06 15:46:55 +00:00
inode.c f2fs: fix to avoid panic in f2fs_evict_inode 2025-08-15 16:39:19 +02:00
iostat.c f2fs: add async reset zone command support 2023-06-12 13:04:09 -07:00
iostat.h
Kconfig f2fs: switch to using the crc32 library 2024-12-01 17:23:02 -08:00
Makefile
namei.c f2fs: fix to correct check conditions in f2fs_cross_rename 2025-05-28 16:05:25 +00:00
node.c f2fs: Fix __write_node_folio() conversion 2025-06-10 14:52:21 +00:00
node.h f2fs: Pass a folio to set_nid() 2025-04-28 15:26:47 +00:00
recovery.c f2fs: Convert dnode_of_data->node_page to node_folio 2025-04-28 15:26:47 +00:00
segment.c f2fs: fix to skip f2fs_balance_fs() if checkpoint is disabled 2025-05-28 16:04:15 +00:00
segment.h f2fs: fix to calculate dirty data during has_not_enough_free_secs() 2025-08-15 16:39:19 +02:00
shrinker.c f2fs: handle error cases of memory donation 2025-05-06 15:46:55 +00:00
super.c f2fs: fix bio memleak when committing super block 2025-08-15 16:39:18 +02:00
sysfs.c f2fs: fix to check upper boundary for gc_no_zoned_gc_percent 2025-08-15 16:39:18 +02:00
verity.c f2fs-6.12-rc1 2024-09-24 15:12:38 -07:00
xattr.c f2fs: Pass a folio to inline_xattr_addr() 2025-04-28 15:26:43 +00:00
xattr.h f2fs: Pass a folio to f2fs_getxattr() 2025-04-28 15:26:42 +00:00