diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 14bf440ea4df..3d72c4445589 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -1455,7 +1455,13 @@ int ocfs2_validate_inode_block(struct super_block *sb, (unsigned long long)bh->b_blocknr); goto bail; } - + if (!le16_to_cpu(di->i_links_count) && !le16_to_cpu(di->i_mode) && + !(le32_to_cpu(di->i_flags) & OCFS2_ORPHANED_FL)) { + mlog(ML_ERROR, "Invalid dinode #%llu: i_mode is zero!\n", + (unsigned long long)bh->b_blocknr); + rc = -EFSCORRUPTED; + goto bail; + } /* * Errors after here are fatal. */