ovl: Treat metacopy dentries as type OVL_PATH_MERGE
authorVivek Goyal <vgoyal@redhat.com>
Fri, 11 May 2018 15:49:32 +0000 (11:49 -0400)
committerMiklos Szeredi <mszeredi@redhat.com>
Fri, 20 Jul 2018 07:56:13 +0000 (09:56 +0200)
Right now OVL_PATH_MERGE is used only for merged directories.  But
conceptually, a metacopy dentry (backed by a lower data dentry) is a merged
entity as well.

So mark metacopy dentries as OVL_PATH_MERGE and ovl_rename() makes use of
this property later to set redirect on a metacopy file.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/util.c

index 73939e08d8bf8dc9dd1127d49d697d9a310ddd29..61ace2de3019f168164007746ede45547800d681 100644 (file)
@@ -134,7 +134,8 @@ enum ovl_path_type ovl_path_type(struct dentry *dentry)
                 */
                if (oe->numlower) {
                        type |= __OVL_PATH_ORIGIN;
-                       if (d_is_dir(dentry))
+                       if (d_is_dir(dentry) ||
+                           !ovl_has_upperdata(d_inode(dentry)))
                                type |= __OVL_PATH_MERGE;
                }
        } else {