[PATCH 3/3] ocfs2: check chain allocator clusters per group in online filecheck
From: Joseph Qi
Date: Tue Nov 24 2026 - 06:54:34 EST
The online filecheck validator reports every dinode condition that
ocfs2_validate_inode_block() checks, with its own message and an
-OCFS2_FILECHECK_ERR_INVALIDINO code instead of ocfs2_error().
Add the clusters per group check there too, so a corrupt cl_cpg is
reported by the filecheck interface as well rather than only being
discovered when the suballocator extends the allocator. As for the
other chain list conditions this is not repairable, so it reports
INVALIDINO and leaves the block untouched.
Signed-off-by: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx>
---
fs/ocfs2/inode.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index e6f89d1e3091..c653b6aee256 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -2220,6 +2220,15 @@ static int ocfs2_filecheck_validate_inode_block(struct super_block *sb,
rc = -OCFS2_FILECHECK_ERR_INVALIDINO;
goto bail;
}
+
+ if (ocfs2_dinode_has_bad_chain_cpg(sb, di)) {
+ mlog(ML_ERROR,
+ "Filecheck: invalid dinode #%llu: clusters per group %u\n",
+ (unsigned long long)bh->b_blocknr,
+ le16_to_cpu(cl->cl_cpg));
+ rc = -OCFS2_FILECHECK_ERR_INVALIDINO;
+ goto bail;
+ }
}
if (ocfs2_dinode_has_refcount_without_loc(di)) {
--
2.39.3