lkml.org 
[lkml]   [2015]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] overlay: Call ovl_drop_write() earlier in ovl_dentry_open()
From
Date
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>
---

fs/overlayfs/inode.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index ce1f349642ab..8a9c32f8f4f9 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -343,31 +343,25 @@ static int ovl_dentry_open(struct dentry *dentry, struct inode *inode,
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, d_backing_inode(realpath.dentry), file, cred);
-out_drop_write:
- if (want_write)
- ovl_drop_write(dentry);
-out:
- return err;
+ return vfs_open(&realpath, d_backing_inode(realpath.dentry), file, cred);
}

static const struct inode_operations ovl_file_inode_operations = {


\
 
 \ /
  Last update: 2015-06-01 16:41    [W:0.114 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site