@@ -314,6 +314,7 @@ struct xfs_rtgroup_geometry {
#define XFS_RTGROUP_GEOM_SICK_SUPER (1 << 0) /* superblock */
#define XFS_RTGROUP_GEOM_SICK_BITMAP (1 << 1) /* rtbitmap for this group */
#define XFS_RTGROUP_GEOM_SICK_RMAPBT (1 << 2) /* reverse mappings */
+#define XFS_RTGROUP_GEOM_SICK_REFCNTBT (1 << 3) /* reference counts */
/*
* Structures for XFS_IOC_FSGROWFSDATA, XFS_IOC_FSGROWFSLOG & XFS_IOC_FSGROWFSRT
@@ -68,6 +68,7 @@ struct xfs_rtgroup;
#define XFS_SICK_RT_SUMMARY (1 << 1) /* realtime summary */
#define XFS_SICK_RT_SUPER (1 << 2) /* rt group superblock */
#define XFS_SICK_RT_RMAPBT (1 << 3) /* reverse mappings */
+#define XFS_SICK_RT_REFCNTBT (1 << 4) /* reference counts */
/* Observable health issues for AG metadata. */
#define XFS_SICK_AG_SB (1 << 0) /* superblock */
@@ -106,7 +107,8 @@ struct xfs_rtgroup;
#define XFS_SICK_RT_PRIMARY (XFS_SICK_RT_BITMAP | \
XFS_SICK_RT_SUMMARY | \
XFS_SICK_RT_SUPER | \
- XFS_SICK_RT_RMAPBT)
+ XFS_SICK_RT_RMAPBT | \
+ XFS_SICK_RT_REFCNTBT)
#define XFS_SICK_AG_PRIMARY (XFS_SICK_AG_SB | \
XFS_SICK_AG_AGF | \
@@ -268,8 +268,10 @@ xfs_iformat_data_fork(
}
return xfs_iformat_rtrmap(ip, dip);
case XFS_DINODE_FMT_REFCOUNT:
- if (!xfs_has_rtreflink(ip->i_mount))
+ if (!xfs_has_rtreflink(ip->i_mount)) {
+ xfs_inode_mark_sick(ip, XFS_SICK_INO_CORE);
return -EFSCORRUPTED;
+ }
return xfs_iformat_rtrefcount(ip, dip);
default:
xfs_inode_verifier_error(ip, -EFSCORRUPTED, __func__,
@@ -27,6 +27,7 @@
#include "xfs_rtgroup.h"
#include "xfs_rtbitmap.h"
#include "xfs_imeta.h"
+#include "xfs_health.h"
static struct kmem_cache *xfs_rtrefcountbt_cur_cache;
@@ -693,8 +694,10 @@ xfs_iformat_rtrefcount(
level = be16_to_cpu(dfp->bb_level);
if (level > mp->m_rtrefc_maxlevels ||
- xfs_rtrefcount_droot_space_calc(level, numrecs) > dsize)
+ xfs_rtrefcount_droot_space_calc(level, numrecs) > dsize) {
+ xfs_inode_mark_sick(ip, XFS_SICK_INO_CORE);
return -EFSCORRUPTED;
+ }
xfs_iroot_alloc(ip, XFS_DATA_FORK,
xfs_rtrefcount_broot_space_calc(mp, level, numrecs));
@@ -532,6 +532,7 @@ static const struct ioctl_sick_map rtgroup_map[] = {
{ XFS_SICK_RT_SUPER, XFS_RTGROUP_GEOM_SICK_SUPER },
{ XFS_SICK_RT_BITMAP, XFS_RTGROUP_GEOM_SICK_BITMAP },
{ XFS_SICK_RT_RMAPBT, XFS_RTGROUP_GEOM_SICK_RMAPBT },
+ { XFS_SICK_RT_REFCNTBT, XFS_RTGROUP_GEOM_SICK_REFCNTBT },
{ 0, 0 },
};
@@ -634,6 +635,9 @@ xfs_btree_mark_sick(
case XFS_BTNUM_RTRMAP:
xfs_rtgroup_mark_sick(cur->bc_ino.rtg, XFS_SICK_RT_RMAPBT);
return;
+ case XFS_BTNUM_RTREFC:
+ xfs_rtgroup_mark_sick(cur->bc_ino.rtg, XFS_SICK_RT_REFCNTBT);
+ return;
case XFS_BTNUM_BNO:
mask = XFS_SICK_AG_BNOBT;
break;
@@ -1968,6 +1968,7 @@ xfs_rtmount_refcountbt(
goto out_path;
if (XFS_IS_CORRUPT(mp, ip->i_df.if_format != XFS_DINODE_FMT_REFCOUNT)) {
+ xfs_rtgroup_mark_sick(rtg, XFS_SICK_RT_REFCNTBT);
error = -EFSCORRUPTED;
goto out_rele;
}