inode_fixup.c: Fix check for directory hard links
authorEric Biggers <ebiggers3@gmail.com>
Sat, 31 May 2014 15:12:28 +0000 (10:12 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 31 May 2014 15:15:07 +0000 (10:15 -0500)
We shouldn't assume that the attributes are consistent, so we should
check both ways for directory hard links.  Specifically, in the case
where the being-inserted dentry is not marked as a directory but for some
reason it shares an inode number with a dentry marked as a directory, we
want to detect that as a directory hard link.

src/inode_fixup.c

index 88a6b8e35c5f5fbc97ded879b3a1358ffbc423fb..115779a410564c1e0c6bbeb937af907802313e76 100644 (file)
@@ -85,7 +85,9 @@ inode_table_insert(struct wim_dentry *dentry, void *_params)
                        params->num_inconsistent_inodes++;
                        continue;
                }
-               if (unlikely(d_inode->i_attributes & FILE_ATTRIBUTE_DIRECTORY)) {
+               if (unlikely((d_inode->i_attributes & FILE_ATTRIBUTE_DIRECTORY) ||
+                            (inode->i_attributes & FILE_ATTRIBUTE_DIRECTORY)))
+               {
                        params->num_dir_hard_links++;
                        if (params->num_dir_hard_links <=
                            MAX_DIR_HARD_LINK_WARNINGS)