[PATCH v2 26/31] ocfs2: check dinode orphaned slots in online filecheck

From: Joseph Qi

Date: Fri Nov 06 2026 - 06:24:58 EST


Wire both orphaned slot predicates into the filecheck validator. Each
predicate keeps its flag guard, so a stale slot field on an inode that
is not orphaned is still accepted.

Signed-off-by: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx>
---
fs/ocfs2/inode.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 2709c139ecff..89c6570d5f9d 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -2056,6 +2056,24 @@ static int ocfs2_filecheck_validate_inode_block(struct super_block *sb,
goto bail;
}

+ if (ocfs2_dinode_has_bad_orphaned_slot(sb, di)) {
+ mlog(ML_ERROR,
+ "Filecheck: invalid dinode #%llu: orphaned slot %u\n",
+ (unsigned long long)bh->b_blocknr,
+ le16_to_cpu(di->i_orphaned_slot));
+ rc = -OCFS2_FILECHECK_ERR_INVALIDINO;
+ goto bail;
+ }
+
+ if (ocfs2_dinode_has_bad_dio_orphaned_slot(sb, di)) {
+ mlog(ML_ERROR,
+ "Filecheck: invalid dinode #%llu: DIO orphaned slot %u\n",
+ (unsigned long long)bh->b_blocknr,
+ le16_to_cpu(di->i_dio_orphaned_slot));
+ rc = -OCFS2_FILECHECK_ERR_INVALIDINO;
+ goto bail;
+ }
+
if (!ocfs2_valid_inode_mode(le16_to_cpu(di->i_mode))) {
mlog(ML_ERROR,
"Filecheck: invalid dinode #%llu: mode 0%o has unknown file type\n",
--
2.39.3