summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-01 11:17:55 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-10-22 16:41:03 -0700
commit773ff2b7bc8ffacf56e69097210a867d989b562c (patch)
tree9719da946e2db2efbcd4a8c4e0dcfe0ceaae7047
parent0e31c90a96c0100c73bbf04bcf57fe4522c27650 (diff)
xfs: report realtime rmap btree corruption errors to the health system
Whenever we encounter corrupt realtime rmap btree blocks, we should report that to the health monitoring system for later reporting. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
-rw-r--r--fs/xfs/libxfs/xfs_fs.h1
-rw-r--r--fs/xfs/libxfs/xfs_health.h4
-rw-r--r--fs/xfs/libxfs/xfs_inode_fork.c4
-rw-r--r--fs/xfs/xfs_health.c4
-rw-r--r--fs/xfs/xfs_rtalloc.c1
5 files changed, 12 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
index ae80a6530750..730463a8f027 100644
--- a/fs/xfs/libxfs/xfs_fs.h
+++ b/fs/xfs/libxfs/xfs_fs.h
@@ -211,6 +211,7 @@ struct xfs_fsop_geom {
#define XFS_FSOP_GEOM_SICK_RT_BITMAP (1 << 4) /* realtime bitmap */
#define XFS_FSOP_GEOM_SICK_RT_SUMMARY (1 << 5) /* realtime summary */
#define XFS_FSOP_GEOM_SICK_QUOTACHECK (1 << 6) /* quota counts */
+#define XFS_FSOP_GEOM_SICK_RT_RMAPBT (1 << 7) /* realtime rmapbt */
/* Output for XFS_FS_COUNTS */
typedef struct xfs_fsop_counts {
diff --git a/fs/xfs/libxfs/xfs_health.h b/fs/xfs/libxfs/xfs_health.h
index 78061dded1a1..968fd6c389d7 100644
--- a/fs/xfs/libxfs/xfs_health.h
+++ b/fs/xfs/libxfs/xfs_health.h
@@ -63,6 +63,7 @@ struct xfs_da_args;
/* Observable health issues for realtime volume metadata. */
#define XFS_SICK_RT_BITMAP (1 << 0) /* realtime bitmap */
#define XFS_SICK_RT_SUMMARY (1 << 1) /* realtime summary */
+#define XFS_SICK_RT_RMAPBT (1 << 2) /* realtime rmapbt */
/* Observable health issues for AG metadata. */
#define XFS_SICK_AG_SB (1 << 0) /* superblock */
@@ -97,7 +98,8 @@ struct xfs_da_args;
XFS_SICK_FS_QUOTACHECK)
#define XFS_SICK_RT_PRIMARY (XFS_SICK_RT_BITMAP | \
- XFS_SICK_RT_SUMMARY)
+ XFS_SICK_RT_SUMMARY | \
+ XFS_SICK_RT_RMAPBT)
#define XFS_SICK_AG_PRIMARY (XFS_SICK_AG_SB | \
XFS_SICK_AG_AGF | \
diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
index 47ee2f1375fc..13e3f3cf4095 100644
--- a/fs/xfs/libxfs/xfs_inode_fork.c
+++ b/fs/xfs/libxfs/xfs_inode_fork.c
@@ -260,8 +260,10 @@ xfs_iformat_data_fork(
case XFS_DINODE_FMT_BTREE:
return xfs_iformat_btree(ip, dip, XFS_DATA_FORK);
case XFS_DINODE_FMT_RMAP:
- if (!xfs_has_rtrmapbt(ip->i_mount))
+ if (!xfs_has_rtrmapbt(ip->i_mount)) {
+ xfs_inode_mark_sick(ip, XFS_SICK_INO_CORE);
return -EFSCORRUPTED;
+ }
return xfs_iformat_rtrmap(ip, dip);
default:
xfs_inode_verifier_error(ip, -EFSCORRUPTED, __func__,
diff --git a/fs/xfs/xfs_health.c b/fs/xfs/xfs_health.c
index 6570677588cb..5d07eca12981 100644
--- a/fs/xfs/xfs_health.c
+++ b/fs/xfs/xfs_health.c
@@ -365,6 +365,7 @@ static const struct ioctl_sick_map fs_map[] = {
static const struct ioctl_sick_map rt_map[] = {
{ XFS_SICK_RT_BITMAP, XFS_FSOP_GEOM_SICK_RT_BITMAP },
{ XFS_SICK_RT_SUMMARY, XFS_FSOP_GEOM_SICK_RT_SUMMARY },
+ { XFS_SICK_RT_RMAPBT, XFS_FSOP_GEOM_SICK_RT_RMAPBT },
{ 0, 0 },
};
@@ -511,6 +512,9 @@ xfs_btree_mark_sick(
case XFS_BTNUM_BMAP:
xfs_bmap_mark_sick(cur->bc_ino.ip, cur->bc_ino.whichfork);
return;
+ case XFS_BTNUM_RTRMAP:
+ xfs_rt_mark_sick(cur->bc_mp, XFS_SICK_RT_RMAPBT);
+ return;
case XFS_BTNUM_BNO:
mask = XFS_SICK_AG_BNOBT;
break;
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 6e654b6741e1..0911b6894f7e 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -1466,6 +1466,7 @@ xfs_rtmount_inodes(
if (XFS_IS_CORRUPT(mp,
mp->m_rrmapip->i_df.if_format !=
XFS_DINODE_FMT_RMAP)) {
+ xfs_rt_mark_sick(mp, XFS_SICK_RT_RMAPBT);
error = -EFSCORRUPTED;
goto out_rrmap;
}