[PATCH 29/30] ocfs2: check dinode refcount location in online filecheck
From: Joseph Qi
Date: Thu Nov 05 2026 - 04:59:19 EST
Wire the OCFS2_HAS_REFCOUNT_FL without i_refcount_loc predicate into the
filecheck validator. A reflink-capable inode with no refcount tree
location cannot be reflinked or have its refcount tree removed cleanly.
Signed-off-by: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx>
---
fs/ocfs2/inode.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index e0fc68ff997a..0f7391c9f30b 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -2185,6 +2185,14 @@ static int ocfs2_filecheck_validate_inode_block(struct super_block *sb,
}
}
+ if (ocfs2_dinode_has_refcount_without_loc(di)) {
+ mlog(ML_ERROR,
+ "Filecheck: inode #%llu has refcount flag but no i_refcount_loc\n",
+ (unsigned long long)bh->b_blocknr);
+ rc = -OCFS2_FILECHECK_ERR_INVALIDINO;
+ goto bail;
+ }
+
bail:
return rc;
}
--
2.39.3