xfs: don't report metadata inodes to fserror

Internal metadata inodes are not exposed to userspace programs, so it
makes no sense to pass them to the fserror functions (aka fsnotify).
Instead, report metadata file problems as general filesystem corruption.

Fixes: 5eb4cb18e4 ("xfs: convey metadata health events to the health monitor")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
Darrick J. Wong 2026-02-18 15:25:38 -08:00 committed by Carlos Maiolino
parent 94014a23e9
commit 75690e5fdd

View file

@ -314,6 +314,18 @@ xfs_rgno_mark_sick(
xfs_rtgroup_put(rtg);
}
static inline void xfs_inode_report_fserror(struct xfs_inode *ip)
{
/* Report metadata inodes as general filesystem corruption */
if (xfs_is_internal_inode(ip)) {
fserror_report_metadata(ip->i_mount->m_super, -EFSCORRUPTED,
GFP_NOFS);
return;
}
fserror_report_file_metadata(VFS_I(ip), -EFSCORRUPTED, GFP_NOFS);
}
/* Mark the unhealthy parts of an inode. */
void
xfs_inode_mark_sick(
@ -339,7 +351,7 @@ xfs_inode_mark_sick(
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);
xfs_inode_report_fserror(ip);
if (mask)
xfs_healthmon_report_inode(ip, XFS_HEALTHMON_SICK, old_mask,
mask);
@ -371,7 +383,7 @@ xfs_inode_mark_corrupt(
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);
xfs_inode_report_fserror(ip);
if (mask)
xfs_healthmon_report_inode(ip, XFS_HEALTHMON_CORRUPT, old_mask,
mask);