Commit f25801ee authored by David Howells's avatar David Howells Committed by Al Viro

overlay: Call ovl_drop_write() earlier in ovl_dentry_open()

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: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 4ef51e8b
...@@ -343,31 +343,25 @@ static int ovl_dentry_open(struct dentry *dentry, struct file *file, ...@@ -343,31 +343,25 @@ static int ovl_dentry_open(struct dentry *dentry, struct file *file,
int err; int err;
struct path realpath; struct path realpath;
enum ovl_path_type type; enum ovl_path_type type;
bool want_write = false;
type = ovl_path_real(dentry, &realpath); type = ovl_path_real(dentry, &realpath);
if (ovl_open_need_copy_up(file->f_flags, type, realpath.dentry)) { if (ovl_open_need_copy_up(file->f_flags, type, realpath.dentry)) {
want_write = true;
err = ovl_want_write(dentry); err = ovl_want_write(dentry);
if (err) if (err)
goto out; return err;
if (file->f_flags & O_TRUNC) if (file->f_flags & O_TRUNC)
err = ovl_copy_up_last(dentry, NULL, true); err = ovl_copy_up_last(dentry, NULL, true);
else else
err = ovl_copy_up(dentry); err = ovl_copy_up(dentry);
ovl_drop_write(dentry);
if (err) if (err)
goto out_drop_write; return err;
ovl_path_upper(dentry, &realpath); ovl_path_upper(dentry, &realpath);
} }
err = vfs_open(&realpath, file, cred); return vfs_open(&realpath, file, cred);
out_drop_write:
if (want_write)
ovl_drop_write(dentry);
out:
return err;
} }
static const struct inode_operations ovl_file_inode_operations = { static const struct inode_operations ovl_file_inode_operations = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment