Skip to content

Commit 6fe1910

Browse files
author
Chandan Babu R
committed
Merge tag 'corruption-health-reports-6.9_2024-02-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-6.9-mergeC
xfs: report corruption to the health trackers Any time that the runtime code thinks it has found corrupt metadata, it should tell the health tracking subsystem that the corresponding part of the filesystem is sick. These reports come primarily from two places -- code that is reading a buffer that fails validation, and higher level pieces that observe a conflict involving multiple buffers. This patchset uses automated scanning to update all such callsites with a mark_sick call. Doing this enables the health system to record problem observed at runtime, which (for now) can prompt the sysadmin to run xfs_scrub, and (later) may enable more targetted fixing of the filesystem. Note: Earlier reviewers of this patchset suggested that the verifier functions themselves should be responsible for calling _mark_sick. In a higher level language this would be easily accomplished with lambda functions and closures. For the kernel, however, we'd have to create the necessary closures by hand, pass them to the buf_read calls, and then implement necessary state tracking to detach the xfs_buf from the closure at the necessary time. This is far too much work and complexity and will not be pursued further. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org> * tag 'corruption-health-reports-6.9_2024-02-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux: xfs: report XFS_IS_CORRUPT errors to the health system xfs: report realtime metadata corruption errors to the health system xfs: report quota block corruption errors to the health system xfs: report inode corruption errors to the health system xfs: report symlink block corruption errors to the health system xfs: report dir/attr block corruption errors to the health system xfs: report btree block corruption errors to the health system xfs: report block map corruption errors to the health tracking system xfs: report ag header corruption errors to the health tracking system xfs: report fs corruption errors to the health tracking system xfs: separate the marking of sick and checked metadata
2 parents 128d0fd + 989d5ec commit 6fe1910

37 files changed

Lines changed: 881 additions & 104 deletions

fs/xfs/libxfs/xfs_ag.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ xfs_initialize_perag_data(
217217
*/
218218
if (fdblocks > sbp->sb_dblocks || ifree > ialloc) {
219219
xfs_alert(mp, "AGF corruption. Please run xfs_repair.");
220+
xfs_fs_mark_sick(mp, XFS_SICK_FS_COUNTERS);
220221
error = -EFSCORRUPTED;
221222
goto out;
222223
}
@@ -950,8 +951,10 @@ xfs_ag_shrink_space(
950951
agf = agfbp->b_addr;
951952
aglen = be32_to_cpu(agi->agi_length);
952953
/* some extra paranoid checks before we shrink the ag */
953-
if (XFS_IS_CORRUPT(mp, agf->agf_length != agi->agi_length))
954+
if (XFS_IS_CORRUPT(mp, agf->agf_length != agi->agi_length)) {
955+
xfs_ag_mark_sick(pag, XFS_SICK_AG_AGF);
954956
return -EFSCORRUPTED;
957+
}
955958
if (delta >= aglen)
956959
return -EINVAL;
957960

0 commit comments

Comments
 (0)