This is a note to let you know that I've just added the patch titled f2fs: retry to update the inode page given data corruption to the 6.1-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-retry-to-update-the-inode-page-given-data-corruption.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 3aa51c61cb4a4dcb40df51ac61171e9ac5a35321 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> Date: Mon, 30 Jan 2023 15:20:09 -0800 Subject: f2fs: retry to update the inode page given data corruption From: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> commit 3aa51c61cb4a4dcb40df51ac61171e9ac5a35321 upstream. If the storage gives a corrupted node block due to short power failure and reset, f2fs stops the entire operations by setting the checkpoint failure flag. Let's give more chances to live by re-issuing IOs for a while in such critical path. Cc: stable@xxxxxxxxxxxxxxx Suggested-by: Randall Huang <huangrandall@xxxxxxxxxx> Suggested-by: Chao Yu <chao@xxxxxxxxxx> Reviewed-by: Chao Yu <chao@xxxxxxxxxx> Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/f2fs/inode.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -708,18 +708,19 @@ void f2fs_update_inode_page(struct inode { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct page *node_page; + int count = 0; retry: node_page = f2fs_get_node_page(sbi, inode->i_ino); if (IS_ERR(node_page)) { int err = PTR_ERR(node_page); - if (err == -ENOMEM) { - cond_resched(); + /* The node block was truncated. */ + if (err == -ENOENT) + return; + + if (err == -ENOMEM || ++count <= DEFAULT_RETRY_IO_COUNT) goto retry; - } else if (err != -ENOENT) { - f2fs_stop_checkpoint(sbi, false, - STOP_CP_REASON_UPDATE_INODE); - } + f2fs_stop_checkpoint(sbi, false, STOP_CP_REASON_UPDATE_INODE); return; } f2fs_update_inode(inode, node_page); Patches currently in stable-queue which might be from jaegeuk@xxxxxxxxxx are queue-6.1/f2fs-fix-kernel-crash-due-to-null-io-bio.patch queue-6.1/f2fs-fix-cgroup-writeback-accounting-with-fs-layer-encryption.patch queue-6.1/f2fs-retry-to-update-the-inode-page-given-data-corruption.patch queue-6.1/f2fs-fix-information-leak-in-f2fs_move_inline_dirents.patch