|
|
@@ -105,12 +105,20 @@ int ovl_getattr(const struct path *path, struct kstat *stat,
|
|
|
* Lower hardlinks may be broken on copy up to different
|
|
|
* upper files, so we cannot use the lower origin st_ino
|
|
|
* for those different files, even for the same fs case.
|
|
|
+ *
|
|
|
+ * Similarly, several redirected dirs can point to the
|
|
|
+ * same dir on a lower layer. With the "verify_lower"
|
|
|
+ * feature, we do not use the lower origin st_ino, if
|
|
|
+ * we haven't verified that this redirect is unique.
|
|
|
+ *
|
|
|
* With inodes index enabled, it is safe to use st_ino
|
|
|
- * of an indexed hardlinked origin. The index validates
|
|
|
- * that the upper hardlink is not broken.
|
|
|
+ * of an indexed origin. The index validates that the
|
|
|
+ * upper hardlink is not broken and that a redirected
|
|
|
+ * dir is the only redirect to that origin.
|
|
|
*/
|
|
|
- if (is_dir || lowerstat.nlink == 1 ||
|
|
|
- ovl_test_flag(OVL_INDEX, d_inode(dentry)))
|
|
|
+ if (ovl_test_flag(OVL_INDEX, d_inode(dentry)) ||
|
|
|
+ (!ovl_verify_lower(dentry->d_sb) &&
|
|
|
+ (is_dir || lowerstat.nlink == 1)))
|
|
|
stat->ino = lowerstat.ino;
|
|
|
|
|
|
if (samefs)
|