From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: jaegeuk@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH] f2fs: call f2fs_handle_critical_error() to set cp_error flag
Date: Fri, 13 Mar 2026 07:24:59 +0000 [thread overview]
Message-ID: <20260313072500.396696-1-chao@kernel.org> (raw)
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>
---
fs/f2fs/f2fs.h | 20 ++++++++++++++++++--
include/linux/f2fs_fs.h | 3 +++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 660bf88a376f..86b92b0aecbd 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -5073,8 +5073,24 @@ 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);
+ }
+ f2fs_handle_critical_error(sbi, stop_reason);
+ }
} else {
sbi->page_eio_ofs[type] = ofs;
sbi->page_eio_cnt[type] = 0;
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index dc41722fcc9d..829a59399dac 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -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,
};
--
2.49.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, Chao Yu <chao@kernel.org>
Subject: [PATCH] f2fs: call f2fs_handle_critical_error() to set cp_error flag
Date: Fri, 13 Mar 2026 07:24:59 +0000 [thread overview]
Message-ID: <20260313072500.396696-1-chao@kernel.org> (raw)
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>
---
fs/f2fs/f2fs.h | 20 ++++++++++++++++++--
include/linux/f2fs_fs.h | 3 +++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 660bf88a376f..86b92b0aecbd 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -5073,8 +5073,24 @@ 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);
+ }
+ f2fs_handle_critical_error(sbi, stop_reason);
+ }
} else {
sbi->page_eio_ofs[type] = ofs;
sbi->page_eio_cnt[type] = 0;
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index dc41722fcc9d..829a59399dac 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -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,
};
--
2.49.0
next reply other threads:[~2026-03-13 7:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 7:24 Chao Yu via Linux-f2fs-devel [this message]
2026-03-13 7:24 ` [PATCH] f2fs: call f2fs_handle_critical_error() to set cp_error flag Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260313072500.396696-1-chao@kernel.org \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.