diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index 4f4964eeb0861eccf20f90ca67d2b3059e908ee8..a138bb3bc2a5de49edbfd85292362ef1eee3584b 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -203,8 +203,14 @@ int ovl_getattr(const struct path *path, struct kstat *stat, if (ovl_test_flag(OVL_INDEX, d_inode(dentry)) || (!ovl_verify_lower(dentry->d_sb) && (is_dir || lowerstat.nlink == 1))) { - stat->ino = lowerstat.ino; lower_layer = ovl_layer_lower(dentry); + /* + * Cannot use origin st_dev;st_ino because + * origin inode content may differ from overlay + * inode content. + */ + if (samefs || lower_layer->fsid) + stat->ino = lowerstat.ino; } /*