This is a note to let you know that I've just added the patch titled f2fs: optimize error handling in redirty_blocks to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: f2fs-optimize-error-handling-in-redirty_blocks.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit a3ce6660e6e4967c4c196721b1d3ce1b0ba1d3af Author: Jack Qiu <jack.qiu@xxxxxxxxxx> Date: Tue May 31 09:16:56 2022 +0800 f2fs: optimize error handling in redirty_blocks [ Upstream commit a4a0e16dbf77582c4f58ab472229dd071b5c4260 ] 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 <jack.qiu@xxxxxxxxxx> Reviewed-by: Chao Yu <chao@xxxxxxxxxx> Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> Stable-dep-of: a4d7f2b3238f ("f2fs: fix to wait page writeback before setting gcing flag") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 8551c3d3c2340..2f2cd520f55d6 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -4011,10 +4011,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(F2FS_I_SB(inode), !page); + set_page_dirty(page); set_page_private_gcing(page); f2fs_put_page(page, 1);