diff options
| author | Chao Yu <chao@kernel.org> | 2026-03-28 08:36:02 +0000 |
|---|---|---|
| committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2026-05-22 03:49:06 +0000 |
| commit | ccc6436abb847352b8ed2de7a8ab2df45bb06622 (patch) | |
| tree | 3eba8cbcbd077cdee20162fa06e62c2c6dce5780 /fs/f2fs/node.c | |
| parent | e6c8140bd06d7dd8ee1e3c690445d3cfcaf1d892 (diff) | |
| download | linux-ccc6436abb847352b8ed2de7a8ab2df45bb06622.tar.gz linux-ccc6436abb847352b8ed2de7a8ab2df45bb06622.zip | |
f2fs: support to report fserror
This patch supports to report fserror, it provides another way to let
userspace to monitor filesystem level error. In addition, it exports
/sys/fs/f2fs/features/fserror once f2fs kernel module start to support
the new feature, then generic/791 of fstests can notice the feature,
and verify validation of fserror report.
Cc: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.c')
| -rw-r--r-- | fs/f2fs/node.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 4e5bd9e4cfc3..b1247de25411 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -12,6 +12,7 @@ #include <linux/blkdev.h> #include <linux/folio_batch.h> #include <linux/swap.h> +#include <linux/fserror.h> #include "f2fs.h" #include "node.h" @@ -1265,6 +1266,8 @@ skip_partial: if (err == -ENOENT) { set_sbi_flag(F2FS_F_SB(folio), SBI_NEED_FSCK); f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR); + fserror_report_file_metadata(dn.inode, -EFSCORRUPTED, + GFP_NOFS); f2fs_err_ratelimited(sbi, "truncate node fail, ino:%llu, nid:%u, " "offset[0]:%d, offset[1]:%d, nofs:%d", @@ -1556,6 +1559,8 @@ out_err: next_blkaddr_of_node(folio)); f2fs_handle_error(sbi, ERROR_INCONSISTENT_FOOTER); + fserror_report_file_metadata(folio->mapping->host, + -EFSCORRUPTED, in_irq ? GFP_NOWAIT : GFP_NOFS); return -EFSCORRUPTED; } @@ -1778,6 +1783,7 @@ static bool __write_node_folio(struct folio *folio, bool atomic, bool do_fsync, if (f2fs_sanity_check_node_footer(sbi, folio, nid, NODE_TYPE_REGULAR, false)) { + fserror_report_metadata(sbi->sb, -EFSCORRUPTED, GFP_NOFS); f2fs_stop_checkpoint(sbi, false, STOP_CP_REASON_CORRUPTED_NID); goto redirty_out; } @@ -2703,6 +2709,8 @@ retry: spin_unlock(&nm_i->nid_list_lock); f2fs_err(sbi, "Corrupted nid %u in free_nid_list", i->nid); + fserror_report_metadata(sbi->sb, -EFSCORRUPTED, + GFP_NOFS); f2fs_stop_checkpoint(sbi, false, STOP_CP_REASON_CORRUPTED_NID); return false; |
