summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-06-18 14:32:23 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-22 14:43:26 -0700
commit0d2ea357d7aaaa93c81bae718f3eb88f90e337e3 (patch)
tree245e633f8669b744e05ab75a69190f687aaabaea
parent583c46f9ce3818c85da204eeb19adfe1d4ea860a (diff)
overlay: Call ovl_drop_write() earlier in ovl_dentry_open()
commit f25801ee4680ef1db21e15c112e6e5fe3ffe8da5 upstream. Call ovl_drop_write() earlier in ovl_dentry_open() before we call vfs_open() as we've done the copy up for which we needed the freeze-write lock by that point. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Cc: "Kamata, Munehisa" <kamatam@amazon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/overlayfs/inode.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 04f124884687..a39224f9c90c 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -342,31 +342,25 @@ static int ovl_dentry_open(struct dentry *dentry, struct file *file,
int err;
struct path realpath;
enum ovl_path_type type;
- bool want_write = false;
type = ovl_path_real(dentry, &realpath);
if (ovl_open_need_copy_up(file->f_flags, type, realpath.dentry)) {
- want_write = true;
err = ovl_want_write(dentry);
if (err)
- goto out;
+ return err;
if (file->f_flags & O_TRUNC)
err = ovl_copy_up_last(dentry, NULL, true);
else
err = ovl_copy_up(dentry);
+ ovl_drop_write(dentry);
if (err)
- goto out_drop_write;
+ return err;
ovl_path_upper(dentry, &realpath);
}
- err = vfs_open(&realpath, file, cred);
-out_drop_write:
- if (want_write)
- ovl_drop_write(dentry);
-out:
- return err;
+ return vfs_open(&realpath, file, cred);
}
static const struct inode_operations ovl_file_inode_operations = {