[PATCH v3 30/31] ocfs2: check dinode refcount location in online filecheck
From: Joseph Qi
Date: Mon Nov 09 2026 - 07:32:20 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 7e299b2dc8c0..6a7dff8a6a05 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -2196,6 +2196,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