f2fs: optimize error handling in redirty_blocks
PATCH 1/1 f2fs: optimize error handling in redirty_blocks
Current error handling is at risk of page leaks. However, we dot't seek any failure scenarios, just use f2fs_bug_on.
Signed-off-by Jack Qiu <[email protected]>
--- fs/f2fs/file.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/f2fs/file.c +4 -4
@@ -3968,10 +3968,10 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len)for (i =0 ; i < page_len; i++, redirty_idx++) { page =find_lock_page (mapping, redirty_idx); -if (!page) { - ret = -ENOMEM ; -break ; - } + +/* It will never fail, when page has pinned above */ +f2fs_bug_on (sbi, !page); +set_page_dirty (page);f2fs_put_page (page,1 );f2fs_put_page (page,0 );
--
2.31.1
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 4 lines · On 2022/5/31 9:16, Jack Qiu via Linux-f2fs-devel wrote:
Current error handling is at risk of page leaks. However, we dot't seek any failure scenarios, just use
f2fs_bug_on.Signed-off-by Jack Qiu <[email protected]>
Reviewed-by Chao Yu <[email protected]>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel