* [f2fs-dev] [PATCH 1/2] f2fs: clean up w/ fscrypt_is_bounce_page()
@ 2025-04-14 10:52 Chao Yu via Linux-f2fs-devel
2025-04-14 10:52 ` [f2fs-dev] [PATCH 2/2] f2fs: fix to detect gcing page in f2fs_is_cp_guaranteed() Chao Yu via Linux-f2fs-devel
2025-04-28 22:40 ` [f2fs-dev] [PATCH 1/2] f2fs: clean up w/ fscrypt_is_bounce_page() patchwork-bot+f2fs--- via Linux-f2fs-devel
0 siblings, 2 replies; 3+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2025-04-14 10:52 UTC (permalink / raw)
To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel
Just cleanup, no logic changes.
Signed-off-by: Chao Yu <chao@kernel.org>
---
fs/f2fs/data.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 1a90aca499f6..4f70755c30cc 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -53,7 +53,7 @@ bool f2fs_is_cp_guaranteed(struct page *page)
struct inode *inode;
struct f2fs_sb_info *sbi;
- if (!mapping)
+ if (fscrypt_is_bounce_page(page))
return false;
inode = mapping->host;
--
2.49.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [f2fs-dev] [PATCH 2/2] f2fs: fix to detect gcing page in f2fs_is_cp_guaranteed()
2025-04-14 10:52 [f2fs-dev] [PATCH 1/2] f2fs: clean up w/ fscrypt_is_bounce_page() Chao Yu via Linux-f2fs-devel
@ 2025-04-14 10:52 ` Chao Yu via Linux-f2fs-devel
2025-04-28 22:40 ` [f2fs-dev] [PATCH 1/2] f2fs: clean up w/ fscrypt_is_bounce_page() patchwork-bot+f2fs--- via Linux-f2fs-devel
1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2025-04-14 10:52 UTC (permalink / raw)
To: jaegeuk; +Cc: Jan Prusakowski, linux-kernel, linux-f2fs-devel
Jan Prusakowski reported a f2fs bug as below:
f2fs/007 will hang kernel during testing w/ below configs:
kernel 6.12.18 (from pixel-kernel/android16-6.12)
export MKFS_OPTIONS="-O encrypt -O extra_attr -O project_quota -O quota"
export F2FS_MOUNT_OPTIONS="test_dummy_encryption,discard,fsync_mode=nobarrier,reserve_root=32768,checkpoint_merge,atgc"
cat /proc/<umount_proc_id>/stack
f2fs_wait_on_all_pages+0xa3/0x130
do_checkpoint+0x40c/0x5d0
f2fs_write_checkpoint+0x258/0x550
kill_f2fs_super+0x14f/0x190
deactivate_locked_super+0x30/0xb0
cleanup_mnt+0xba/0x150
task_work_run+0x59/0xa0
syscall_exit_to_user_mode+0x12d/0x130
do_syscall_64+0x57/0x110
entry_SYSCALL_64_after_hwframe+0x76/0x7e
cat /sys/kernel/debug/f2fs/status
- IO_W (CP: -256, Data: 256, Flush: ( 0 0 1), Discard: ( 0 0)) cmd: 0 undiscard: 0
CP IOs reference count becomes negative.
The root cause is:
After 4961acdd65c9 ("f2fs: fix to tag gcing flag on page during block
migration"), we will tag page w/ gcing flag for raw page of cluster
during its migration.
However, if the inode is both encrypted and compressed, during
ioc_decompress(), it will tag page w/ gcing flag, and it increase
F2FS_WB_DATA reference count:
- f2fs_write_multi_page
- f2fs_write_raw_page
- f2fs_write_single_page
- do_write_page
- f2fs_submit_page_write
- WB_DATA_TYPE(bio_page, fio->compressed_page)
: bio_page is encrypted, so mapping is NULL, and fio->compressed_page
is NULL, it returns F2FS_WB_DATA
- inc_page_count(.., F2FS_WB_DATA)
Then, during end_io(), it decrease F2FS_WB_CP_DATA reference count:
- f2fs_write_end_io
- f2fs_compress_write_end_io
- fscrypt_pagecache_folio
: get raw page from encrypted page
- WB_DATA_TYPE(&folio->page, false)
: raw page has gcing flag, it returns F2FS_WB_CP_DATA
- dec_page_count(.., F2FS_WB_CP_DATA)
In order to fix this issue, we need to detect gcing flag in raw page
in f2fs_is_cp_guaranteed().
Fixes: 4961acdd65c9 ("f2fs: fix to tag gcing flag on page during block migration")
Reported-by: Jan Prusakowski <jprusakowski@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
---
fs/f2fs/data.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 4f70755c30cc..0df60c3ca533 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -54,7 +54,7 @@ bool f2fs_is_cp_guaranteed(struct page *page)
struct f2fs_sb_info *sbi;
if (fscrypt_is_bounce_page(page))
- return false;
+ return page_private_gcing(fscrypt_pagecache_page(page));
inode = mapping->host;
sbi = F2FS_I_SB(inode);
--
2.49.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH 1/2] f2fs: clean up w/ fscrypt_is_bounce_page()
2025-04-14 10:52 [f2fs-dev] [PATCH 1/2] f2fs: clean up w/ fscrypt_is_bounce_page() Chao Yu via Linux-f2fs-devel
2025-04-14 10:52 ` [f2fs-dev] [PATCH 2/2] f2fs: fix to detect gcing page in f2fs_is_cp_guaranteed() Chao Yu via Linux-f2fs-devel
@ 2025-04-28 22:40 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+f2fs--- via Linux-f2fs-devel @ 2025-04-28 22:40 UTC (permalink / raw)
To: Chao Yu; +Cc: jaegeuk, linux-kernel, linux-f2fs-devel
Hello:
This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:
On Mon, 14 Apr 2025 18:52:36 +0800 you wrote:
> Just cleanup, no logic changes.
>
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
> fs/f2fs/data.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- [f2fs-dev,1/2] f2fs: clean up w/ fscrypt_is_bounce_page()
https://git.kernel.org/jaegeuk/f2fs/c/0c708e35cf26
- [f2fs-dev,2/2] f2fs: fix to detect gcing page in f2fs_is_cp_guaranteed()
https://git.kernel.org/jaegeuk/f2fs/c/aa1be8dd6416
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-28 22:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 10:52 [f2fs-dev] [PATCH 1/2] f2fs: clean up w/ fscrypt_is_bounce_page() Chao Yu via Linux-f2fs-devel
2025-04-14 10:52 ` [f2fs-dev] [PATCH 2/2] f2fs: fix to detect gcing page in f2fs_is_cp_guaranteed() Chao Yu via Linux-f2fs-devel
2025-04-28 22:40 ` [f2fs-dev] [PATCH 1/2] f2fs: clean up w/ fscrypt_is_bounce_page() patchwork-bot+f2fs--- via Linux-f2fs-devel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).