[PATCH] f2fs: f2fs_get_meta_page_nofail should not be failed
From: Jaegeuk Kim
Date: Fri Oct 02 2020 - 17:32:29 EST
Otherwise, f2fs can break the the consistency.
(e.g., BUG_ON in f2fs_get_sum_page)
Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
---
fs/f2fs/checkpoint.c | 9 +++------
fs/f2fs/f2fs.h | 2 --
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index f18386d30f031..7bb3a741a8f16 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -110,15 +110,12 @@ struct page *f2fs_get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index)
struct page *f2fs_get_meta_page_nofail(struct f2fs_sb_info *sbi, pgoff_t index)
{
struct page *page;
- int count = 0;
-
retry:
page = __get_meta_page(sbi, index, true);
if (IS_ERR(page)) {
- if (PTR_ERR(page) == -EIO &&
- ++count <= DEFAULT_RETRY_IO_COUNT)
- goto retry;
- f2fs_stop_checkpoint(sbi, false);
+ f2fs_flush_merged_writes(sbi);
+ congestion_wait(BLK_RW_ASYNC, DEFAULT_IO_TIMEOUT);
+ goto retry;
}
return page;
}
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 9d58fd5dae139..d905edb42c327 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -595,8 +595,6 @@ enum {
*/
};
-#define DEFAULT_RETRY_IO_COUNT 8 /* maximum retry read IO count */
-
/* congestion wait timeout value, default: 20ms */
#define DEFAULT_IO_TIMEOUT (msecs_to_jiffies(20))
--
2.28.0.806.g8561365e88-goog