[21/21] xfs: report realtime rmap btree corruption errors to the health system
diff mbox series

Message ID 157784151051.1368137.9892653832705151596.stgit@magnolia
State New
Headers show
Series
  • xfs: realtime reverse-mapping support
Related show

Commit Message

Darrick J. Wong Jan. 1, 2020, 1:18 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

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 <darrick.wong@oracle.com>
---
 fs/xfs/libxfs/xfs_inode_fork.c |    7 ++++++-
 fs/xfs/xfs_health.c            |    3 +++
 fs/xfs/xfs_rtalloc.c           |    1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
index 758bf44693ba..93e80435c113 100644
--- a/fs/xfs/libxfs/xfs_inode_fork.c
+++ b/fs/xfs/libxfs/xfs_inode_fork.c
@@ -78,8 +78,13 @@  xfs_iformat_fork(
 			error = xfs_iformat_btree(ip, dip, XFS_DATA_FORK);
 			break;
 		case XFS_DINODE_FMT_RMAP:
-			if (!xfs_sb_version_hasrtrmapbt(&ip->i_mount->m_sb))
+			if (!xfs_sb_version_hasrtrmapbt(&ip->i_mount->m_sb)) {
+				xfs_inode_verifier_error(ip, -EFSCORRUPTED,
+						__func__, dip, sizeof(*dip),
+						__this_address);
+				xfs_inode_mark_sick(ip, XFS_SICK_INO_CORE);
 				return -EFSCORRUPTED;
+			}
 			error = xfs_iformat_rmap(ip, dip);
 			break;
 		default:
diff --git a/fs/xfs/xfs_health.c b/fs/xfs/xfs_health.c
index e328b048edb0..fc0cea221985 100644
--- a/fs/xfs/xfs_health.c
+++ b/fs/xfs/xfs_health.c
@@ -505,6 +505,9 @@  xfs_btree_mark_sick(
 		xfs_bmap_mark_sick(cur->bc_private.b.ip,
 				   cur->bc_private.b.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 765f648ffe2b..ccbaebafba9b 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -1326,6 +1326,7 @@  xfs_rtmount_inodes(
 		if (XFS_IS_CORRUPT(mp,
 				   mp->m_rrmapip->i_d.di_format !=
 				   XFS_DINODE_FMT_RMAP)) {
+			xfs_rt_mark_sick(mp, XFS_SICK_RT_RMAPBT);
 			error = -EFSCORRUPTED;
 			goto out_rrmap;
 		}