Skip to content

Commit bd882ff

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: call f2fs_handle_critical_error() to set cp_error flag
f2fs_handle_page_eio() is the only left place we set CP_ERROR_FLAG directly, it missed to update superblock.s_stop_reason, let's call f2fs_handle_critical_error() instead to fix that. Introduce STOP_CP_REASON_READ_{META,NODE,DATA} stop_cp_reason enum variable to indicate which kind of data we failed to read. Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 5471834 commit bd882ff

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

fs/f2fs/f2fs.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5070,8 +5070,25 @@ static inline void f2fs_handle_page_eio(struct f2fs_sb_info *sbi,
50705070
return;
50715071

50725072
if (ofs == sbi->page_eio_ofs[type]) {
5073-
if (sbi->page_eio_cnt[type]++ == MAX_RETRY_PAGE_EIO)
5074-
set_ckpt_flags(sbi, CP_ERROR_FLAG);
5073+
if (sbi->page_eio_cnt[type]++ == MAX_RETRY_PAGE_EIO) {
5074+
enum stop_cp_reason stop_reason;
5075+
5076+
switch (type) {
5077+
case META:
5078+
stop_reason = STOP_CP_REASON_READ_META;
5079+
break;
5080+
case NODE:
5081+
stop_reason = STOP_CP_REASON_READ_NODE;
5082+
break;
5083+
case DATA:
5084+
stop_reason = STOP_CP_REASON_READ_DATA;
5085+
break;
5086+
default:
5087+
f2fs_bug_on(sbi, 1);
5088+
return;
5089+
}
5090+
f2fs_handle_critical_error(sbi, stop_reason);
5091+
}
50755092
} else {
50765093
sbi->page_eio_ofs[type] = ofs;
50775094
sbi->page_eio_cnt[type] = 0;

include/linux/f2fs_fs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ enum stop_cp_reason {
8080
STOP_CP_REASON_NO_SEGMENT,
8181
STOP_CP_REASON_CORRUPTED_FREE_BITMAP,
8282
STOP_CP_REASON_CORRUPTED_NID,
83+
STOP_CP_REASON_READ_META,
84+
STOP_CP_REASON_READ_NODE,
85+
STOP_CP_REASON_READ_DATA,
8386
STOP_CP_REASON_MAX,
8487
};
8588

0 commit comments

Comments
 (0)