Partially revert "locks: fix file locking on overlayfs"
[linux-2.6-block.git] / fs / overlayfs / super.c
index e8551c97de51c0676416d982aad60b9ca72c0373..c63beccad4fc9aecce2785e30f3f25ded96c0d44 100644 (file)
@@ -92,13 +92,14 @@ static int ovl_check_append_only(struct inode *inode, int flag)
 
 static struct dentry *ovl_d_real(struct dentry *dentry,
                                 const struct inode *inode,
-                                unsigned int open_flags, unsigned int flags)
+                                unsigned int open_flags)
 {
        struct dentry *real;
        int err;
 
-       if (flags & D_REAL_UPPER)
-               return ovl_dentry_upper(dentry);
+       /* It's an overlay file */
+       if (inode && d_inode(dentry) == inode)
+               return dentry;
 
        if (!d_is_reg(dentry)) {
                if (!inode || inode == d_inode(dentry))
@@ -127,7 +128,7 @@ static struct dentry *ovl_d_real(struct dentry *dentry,
                goto bug;
 
        /* Handle recursion */
-       real = d_real(real, inode, open_flags, 0);
+       real = d_real(real, inode, open_flags);
 
        if (!inode || inode == d_inode(real))
                return real;
@@ -611,11 +612,10 @@ retry:
                        goto retry;
                }
 
-               err = ovl_create_real(dir, work,
-                                     &(struct cattr){.mode = S_IFDIR | 0},
-                                     NULL, true);
-               if (err)
-                       goto out_dput;
+               work = ovl_create_real(dir, work, OVL_CATTR(attr.ia_mode));
+               err = PTR_ERR(work);
+               if (IS_ERR(work))
+                       goto out_err;
 
                /*
                 * Try to remove POSIX ACL xattrs from workdir.  We are good if:
@@ -1456,7 +1456,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
        sb->s_op = &ovl_super_operations;
        sb->s_xattr = ovl_xattr_handlers;
        sb->s_fs_info = ofs;
-       sb->s_flags |= SB_POSIXACL | SB_NOREMOTELOCK;
+       sb->s_flags |= SB_POSIXACL;
 
        err = -ENOMEM;
        root_dentry = d_make_root(ovl_new_inode(sb, S_IFDIR, 0));