]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/overlayfs/super.c
Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[mirror_ubuntu-artful-kernel.git] / fs / overlayfs / super.c
index 9a7693d5f8fffb38bd4a07804e4627ed7f50361a..5e254b3a8c5601256d8960ed66a304081210cce1 100644 (file)
@@ -304,7 +304,9 @@ static void ovl_dentry_release(struct dentry *dentry)
        }
 }
 
-static struct dentry *ovl_d_real(struct dentry *dentry, struct inode *inode)
+static struct dentry *ovl_d_real(struct dentry *dentry,
+                                const struct inode *inode,
+                                unsigned int open_flags)
 {
        struct dentry *real;
 
@@ -314,6 +316,16 @@ static struct dentry *ovl_d_real(struct dentry *dentry, struct inode *inode)
                goto bug;
        }
 
+       if (d_is_negative(dentry))
+               return dentry;
+
+       if (open_flags) {
+               int err = ovl_open_maybe_copy_up(dentry, open_flags);
+
+               if (err)
+                       return ERR_PTR(err);
+       }
+
        real = ovl_dentry_upper(dentry);
        if (real && (!inode || inode == d_inode(real)))
                return real;
@@ -326,9 +338,7 @@ static struct dentry *ovl_d_real(struct dentry *dentry, struct inode *inode)
                return real;
 
        /* Handle recursion */
-       if (real->d_flags & DCACHE_OP_REAL)
-               return real->d_op->d_real(real, inode);
-
+       return d_real(real, inode, open_flags);
 bug:
        WARN(1, "ovl_d_real(%pd4, %s:%lu\n): real dentry not found\n", dentry,
             inode ? inode->i_sb->s_id : "NULL", inode ? inode->i_ino : 0);
@@ -378,13 +388,11 @@ static int ovl_dentry_weak_revalidate(struct dentry *dentry, unsigned int flags)
 
 static const struct dentry_operations ovl_dentry_operations = {
        .d_release = ovl_dentry_release,
-       .d_select_inode = ovl_d_select_inode,
        .d_real = ovl_d_real,
 };
 
 static const struct dentry_operations ovl_reval_dentry_operations = {
        .d_release = ovl_dentry_release,
-       .d_select_inode = ovl_d_select_inode,
        .d_real = ovl_d_real,
        .d_revalidate = ovl_dentry_revalidate,
        .d_weak_revalidate = ovl_dentry_weak_revalidate,