From c84c2424932d18cf3888adfe9bd16f95dc5d9fd4 Mon Sep 17 00:00:00 2001 From: zangyangyang1 Date: Mon, 13 Jan 2025 11:05:18 +0800 Subject: [PATCH] f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages 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 Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- fs/f2fs/compress.c | 1 + fs/f2fs/data.c | 1 + 2 files changed, 2 insertions(+) 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 @@ continue_unlock: 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 35b9455fb899..e9582e06403b 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3154,6 +3154,7 @@ continue_unlock: continue; } #endif + submitted = 0; ret = f2fs_write_single_data_page(folio, &submitted, &bio, &last_block, wbc, io_type, 0, true);