]> git.hungrycats.org Git - linux/commitdiff
fix a braino in ovl_d_select_inode()
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 12 Jul 2015 14:39:45 +0000 (10:39 -0400)
committerSasha Levin <sasha.levin@oracle.com>
Wed, 28 Oct 2015 02:14:25 +0000 (22:14 -0400)
[ Upstream commit 9391dd00d13c853ab4f2a85435288ae2202e0e43 ]

when opening a directory we want the overlayfs inode, not one from
the topmost layer.

Reported-By: Andrey Jr. Melnikov <temnota.am@gmail.com>
Tested-By: Andrey Jr. Melnikov <temnota.am@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
fs/overlayfs/inode.c

index 336aeddbacfe55ff49c5ee6bcba4889ce0744094..e3903b74a1f2f7b335971687d15d7a398dc3b119 100644 (file)
@@ -339,6 +339,9 @@ struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags)
        struct path realpath;
        enum ovl_path_type type;
 
+       if (d_is_dir(dentry))
+               return d_backing_inode(dentry);
+
        type = ovl_path_real(dentry, &realpath);
        if (ovl_open_need_copy_up(file_flags, type, realpath.dentry)) {
                err = ovl_want_write(dentry);