]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
f2fs: fix using wrong 'submitted' value in f2fs_write_cache_pages
authorzangyangyang1 <zangyangyang1@xiaomi.com>
Mon, 13 Jan 2025 03:05:18 +0000 (11:05 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 13 Jan 2025 18:49:38 +0000 (18:49 +0000)
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>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/compress.c
fs/f2fs/data.c

index c5e42eec8ac9aebfa3694fa65a3831807785b036..985690d81a82c9d1e69e7d4f4e77956d3028d8c2 100644 (file)
@@ -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,
index 35b9455fb8999088d761e025fe9d6e85a8db578b..e9582e06403b6715a1ba904603d88bf16279e9d1 100644 (file)
@@ -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);