diff options
| author | Darrick J. Wong <djwong@kernel.org> | 2026-01-12 16:31:56 -0800 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-01-13 09:58:01 +0100 |
| commit | efd87a10072966e1555e1288a570c883c73182c3 (patch) | |
| tree | 85acb65f433785fce4bb43a4abda37839ed51c13 | |
| parent | a9d573ee88af980f14fdadb5c12bbf6a195fb3f1 (diff) | |
xfs: report fs metadata errors via fsnotify
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>
Link: https://patch.msgid.link/176826402652.3490369.2609467634858507969.stgit@frogsfrogsfrogs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>
| -rw-r--r-- | fs/xfs/xfs_fsops.c | 4 | ||||
| -rw-r--r-- | fs/xfs/xfs_health.c | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index 0ada73569394..b7c21f68edc7 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 3c1557fb1cf0..fbb8886c72fe 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. */ |
