Skip to contentSkip to conversation

f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages

PATCH Applied YangYang Zang 2 participants 3 messages Jan 13, 2025 F2FS file system

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages

From: zangyangyang1 <[email protected]>

When f2fs_write_single_data_page fails, f2fs_write_cache_pages will use the last 'submitted' value incorrectly, which will cause 'nwritten' and 'wbc->nr_to_write' calculation errors

---
v4: The Callers initializes it
v3: No logical changes, just format patch
v2: Initialize "submitted" in f2fs_write_single_data_page()

---
 fs/f2fs/compress.c | 1 +
 fs/f2fs/data.c     | 1 +
 2 files changed, 2 insertions(+)
fs/f2fs/compress.c +1 -0
index c5e42eec8ac9..985690d81a82 100644
@@ -1551,6 +1551,7 @@ static int f2fs_write_raw_pages(struct compress_ctx *cc,
 		if (!clear_page_dirty_for_io(cc->rpages[i]))
 			goto continue_unlock;
 
+		submitted = 0;
 		ret = f2fs_write_single_data_page(page_folio(cc->rpages[i]),
 						&submitted,
 						NULL, NULL, wbc, io_type,
fs/f2fs/data.c +1 -0
index f681742ebecb..008ecd8fd386 100644
@@ -3150,6 +3150,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
 				continue;
 			}
 #endif
+			submitted = 0;
 			ret = f2fs_write_single_data_page(folio,
 					&submitted, &bio, &last_block,
 					wbc, io_type, 0, true);
Signature · 8 lines
2.43.2



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Reviewed-by Chao Yu on v4 1/1
#1 lore raw
Quoted 7 lines · YangYang Zang

From: zangyangyang1 <[email protected]>

When f2fs_write_single_data_page fails, f2fs_write_cache_pages will use the last 'submitted' value incorrectly, which will cause 'nwritten' and 'wbc->nr_to_write' calculation errors

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#2 lore raw
In reply to YangYang Zang

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 9 lines · On Mon, 13 Jan 2025 11:05:18 +0800 you wrote:

From: zangyangyang1 <[email protected]>

When f2fs_write_single_data_page fails, f2fs_write_cache_pages will use the last 'submitted' value incorrectly, which will cause 'nwritten' and 'wbc->nr_to_write' calculation errors

[...]

Here is the summary with links:
- [f2fs-dev,v4] f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages

    https://git.kernel.org/jaegeuk/f2fs/c/c84c2424932d

You are awesome, thank you!

Signature · 10 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel