diff mbox series

[f2fs-dev,v4] f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages

Message ID 20250113030518.3639169-1-zangyangyang1@xiaomi.com (mailing list archive)
State Accepted
Commit c84c2424932d18cf3888adfe9bd16f95dc5d9fd4
Headers show
Series [f2fs-dev,v4] f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages | expand

Commit Message

YangYang Zang Jan. 13, 2025, 3:05 a.m. UTC
From: zangyangyang1 <zangyangyang1@xiaomi.com>

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

Signed-off-by: zangyangyang1 <zangyangyang1@xiaomi.com>
---
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(+)

Comments

Chao Yu Jan. 13, 2025, 1:33 p.m. UTC | #1
On 2025/1/13 11:05, YangYang Zang wrote:
> From: zangyangyang1 <zangyangyang1@xiaomi.com>
> 
> 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
> 
> Signed-off-by: zangyangyang1 <zangyangyang1@xiaomi.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,
patchwork-bot+f2fs--- via Linux-f2fs-devel Jan. 13, 2025, 6:51 p.m. UTC | #2
Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Mon, 13 Jan 2025 11:05:18 +0800 you wrote:
> From: zangyangyang1 <zangyangyang1@xiaomi.com>
> 
> 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
> 
> Signed-off-by: zangyangyang1 <zangyangyang1@xiaomi.com>
> 
> [...]

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!
diff mbox series

Patch

diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index c5e42eec8ac9..985690d81a82 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -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,
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index f681742ebecb..008ecd8fd386 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -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);