From: "Darrick J. Wong" <djwong@kernel.org>
To: brauner@kernel.org, djwong@kernel.org
Cc: linux-ext4@vger.kernel.org, jack@suse.cz,
linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
gabriel@krisman.be, hch@lst.de, amir73il@gmail.com
Subject: [PATCH 4/6] xfs: report fs metadata errors via fsnotify
Date: Wed, 17 Dec 2025 18:03:43 -0800 [thread overview]
Message-ID: <176602332214.686273.889498283534575167.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <176602332085.686273.7564676516217176769.stgit@frogsfrogsfrogs>
From: Darrick J. Wong <djwong@kernel.org>
Report filesystem corruption problems to the fserror helpers so that
fsnotify can also convey metadata problems to userspace.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
fs/xfs/xfs_fsops.c | 4 ++++
fs/xfs/xfs_health.c | 14 ++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 0ada735693945c..b7c21f68edc78d 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -26,6 +26,8 @@
#include "xfs_rtrefcount_btree.h"
#include "xfs_metafile.h"
+#include <linux/fserror.h>
+
/*
* Write new AG headers to disk. Non-transactional, but need to be
* written and completed prior to the growfs transaction being logged.
@@ -540,6 +542,8 @@ xfs_do_force_shutdown(
"Please unmount the filesystem and rectify the problem(s)");
if (xfs_error_level >= XFS_ERRLEVEL_HIGH)
xfs_stack_trace();
+
+ fserror_report_shutdown(mp->m_super, GFP_KERNEL);
}
/*
diff --git a/fs/xfs/xfs_health.c b/fs/xfs/xfs_health.c
index 3c1557fb1cf083..fbb8886c72fe5e 100644
--- a/fs/xfs/xfs_health.c
+++ b/fs/xfs/xfs_health.c
@@ -20,6 +20,8 @@
#include "xfs_quota_defs.h"
#include "xfs_rtgroup.h"
+#include <linux/fserror.h>
+
static void
xfs_health_unmount_group(
struct xfs_group *xg,
@@ -111,6 +113,8 @@ xfs_fs_mark_sick(
spin_lock(&mp->m_sb_lock);
mp->m_fs_sick |= mask;
spin_unlock(&mp->m_sb_lock);
+
+ fserror_report_metadata(mp->m_super, -EFSCORRUPTED, GFP_NOFS);
}
/* Mark per-fs metadata as having been checked and found unhealthy by fsck. */
@@ -126,6 +130,8 @@ xfs_fs_mark_corrupt(
mp->m_fs_sick |= mask;
mp->m_fs_checked |= mask;
spin_unlock(&mp->m_sb_lock);
+
+ fserror_report_metadata(mp->m_super, -EFSCORRUPTED, GFP_NOFS);
}
/* Mark a per-fs metadata healed. */
@@ -198,6 +204,8 @@ xfs_group_mark_sick(
spin_lock(&xg->xg_state_lock);
xg->xg_sick |= mask;
spin_unlock(&xg->xg_state_lock);
+
+ fserror_report_metadata(xg->xg_mount->m_super, -EFSCORRUPTED, GFP_NOFS);
}
/*
@@ -215,6 +223,8 @@ xfs_group_mark_corrupt(
xg->xg_sick |= mask;
xg->xg_checked |= mask;
spin_unlock(&xg->xg_state_lock);
+
+ fserror_report_metadata(xg->xg_mount->m_super, -EFSCORRUPTED, GFP_NOFS);
}
/*
@@ -287,6 +297,8 @@ xfs_inode_mark_sick(
spin_lock(&VFS_I(ip)->i_lock);
inode_state_clear(VFS_I(ip), I_DONTCACHE);
spin_unlock(&VFS_I(ip)->i_lock);
+
+ fserror_report_file_metadata(VFS_I(ip), -EFSCORRUPTED, GFP_NOFS);
}
/* Mark inode metadata as having been checked and found unhealthy by fsck. */
@@ -311,6 +323,8 @@ xfs_inode_mark_corrupt(
spin_lock(&VFS_I(ip)->i_lock);
inode_state_clear(VFS_I(ip), I_DONTCACHE);
spin_unlock(&VFS_I(ip)->i_lock);
+
+ fserror_report_file_metadata(VFS_I(ip), -EFSCORRUPTED, GFP_NOFS);
}
/* Mark parts of an inode healed. */
next prev parent reply other threads:[~2025-12-18 2:03 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 2:02 [PATCHSET V4 1/2] fs: generic file IO error reporting Darrick J. Wong
2025-12-18 2:02 ` [PATCH 1/6] uapi: promote EFSCORRUPTED and EUCLEAN to errno.h Darrick J. Wong
2025-12-18 5:17 ` Christoph Hellwig
2025-12-18 11:04 ` Alejandro Colomar
2025-12-18 18:45 ` Darrick J. Wong
2025-12-18 9:33 ` Gao Xiang
2025-12-22 15:01 ` Jan Kara
2025-12-18 2:03 ` [PATCH 2/6] fs: report filesystem and file I/O errors to fsnotify Darrick J. Wong
2025-12-18 5:21 ` Christoph Hellwig
2025-12-18 18:44 ` Darrick J. Wong
2025-12-24 12:29 ` Christian Brauner
2026-01-06 16:42 ` Darrick J. Wong
2026-01-12 13:17 ` Christian Brauner
2026-01-12 18:50 ` Darrick J. Wong
2025-12-18 23:32 ` [PATCH V4.1 " Darrick J. Wong
2025-12-22 15:36 ` [PATCH " Jan Kara
2026-01-06 17:35 ` Darrick J. Wong
2025-12-18 2:03 ` [PATCH 3/6] iomap: report file I/O errors to the VFS Darrick J. Wong
2025-12-18 5:22 ` Christoph Hellwig
2025-12-22 15:30 ` Jan Kara
2025-12-18 2:03 ` Darrick J. Wong [this message]
2025-12-18 5:22 ` [PATCH 4/6] xfs: report fs metadata errors via fsnotify Christoph Hellwig
2025-12-18 2:03 ` [PATCH 5/6] xfs: translate fsdax media errors into file "data lost" errors when convenient Darrick J. Wong
2025-12-18 5:23 ` Christoph Hellwig
2025-12-18 2:04 ` [PATCH 6/6] ext4: convert to new fserror helpers Darrick J. Wong
2025-12-18 5:23 ` Christoph Hellwig
2025-12-22 15:34 ` Jan Kara
2026-01-06 17:30 ` Darrick J. Wong
2026-01-06 23:33 ` [PATCH 7/6] fs: improve comment in fserror_alloc_event Darrick J. Wong
2026-01-07 9:19 ` Jan Kara
-- strict thread matches above, loose matches on Subject: below --
2026-01-13 0:31 [PATCHSET v5] fs: generic file IO error reporting Darrick J. Wong
2026-01-13 0:31 ` [PATCH 4/6] xfs: report fs metadata errors via fsnotify Darrick J. Wong
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=176602332214.686273.889498283534575167.stgit@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=gabriel@krisman.be \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox