mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
FROMGIT: f2fs: retry to update the inode page given data corruption
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. Bug: 263464787 Bug: 261682528 Cc: stable@vger.kernel.org Suggested-by: Randall Huang <huangrandall@google.com> Suggested-by: Chao Yu <chao@kernel.org> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> (cherry picked from commit 0d94ab0aa9d2fbb68d2fe8d116e70293d2884fe1 https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev) Change-Id: I2e05a56fd3488085ddc34a8e01e6351c7a30c7e9
This commit is contained in:
@@ -690,18 +690,19 @@ void f2fs_update_inode_page(struct inode *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);
|
||||
|
||||
Reference in New Issue
Block a user