diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index a510a0eb1adc..d483e0c61d12 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c @@ -1477,6 +1477,15 @@ int ocfs2_validate_inode_block(struct super_block *sb, goto bail; } + if ((le32_to_cpu(di->i_flags) & OCFS2_ORPHANED_FL) && + ocfs2_read_links_count(di)) { + rc = ocfs2_error(sb, + "Invalid dinode #%llu: orphaned with %u links\n", + (unsigned long long)bh->b_blocknr, + ocfs2_read_links_count(di)); + goto bail; + } + if (le32_to_cpu(di->i_fs_generation) != OCFS2_SB(sb)->fs_generation) { rc = ocfs2_error(sb,