]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
f2fs: call f2fs_handle_critical_error() to set cp_error flag
authorChao Yu <chao@kernel.org>
Mon, 23 Mar 2026 08:38:32 +0000 (16:38 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 24 Mar 2026 17:21:01 +0000 (17:21 +0000)
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>
fs/f2fs/f2fs.h
include/linux/f2fs_fs.h

index 8942b2a63cfdab85ce3488c6151e509f7b37b25c..931f8394bb1802537eacd78a282658d1a90895cc 100644 (file)
@@ -5070,8 +5070,25 @@ static inline void f2fs_handle_page_eio(struct f2fs_sb_info *sbi,
                return;
 
        if (ofs == sbi->page_eio_ofs[type]) {
-               if (sbi->page_eio_cnt[type]++ == MAX_RETRY_PAGE_EIO)
-                       set_ckpt_flags(sbi, CP_ERROR_FLAG);
+               if (sbi->page_eio_cnt[type]++ == MAX_RETRY_PAGE_EIO) {
+                       enum stop_cp_reason stop_reason;
+
+                       switch (type) {
+                       case META:
+                               stop_reason = STOP_CP_REASON_READ_META;
+                               break;
+                       case NODE:
+                               stop_reason = STOP_CP_REASON_READ_NODE;
+                               break;
+                       case DATA:
+                               stop_reason = STOP_CP_REASON_READ_DATA;
+                               break;
+                       default:
+                               f2fs_bug_on(sbi, 1);
+                               return;
+                       }
+                       f2fs_handle_critical_error(sbi, stop_reason);
+               }
        } else {
                sbi->page_eio_ofs[type] = ofs;
                sbi->page_eio_cnt[type] = 0;
index dc41722fcc9dde55cafbe04bb04a23a200c593a6..829a59399dacf9e065c6e86b0db7ae21dac9d205 100644 (file)
@@ -80,6 +80,9 @@ enum stop_cp_reason {
        STOP_CP_REASON_NO_SEGMENT,
        STOP_CP_REASON_CORRUPTED_FREE_BITMAP,
        STOP_CP_REASON_CORRUPTED_NID,
+       STOP_CP_REASON_READ_META,
+       STOP_CP_REASON_READ_NODE,
+       STOP_CP_REASON_READ_DATA,
        STOP_CP_REASON_MAX,
 };