[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150618133223.12722.1869.stgit@warthog.procyon.org.uk>
Date: Thu, 18 Jun 2015 14:32:23 +0100
From: David Howells <dhowells@...hat.com>
To: sds@...ho.nsa.gov, viro@...iv.linux.org.uk, miklos@...redi.hu
Cc: linux-fsdevel@...r.kernel.org, dhowells@...hat.com,
linux-security-module@...r.kernel.org,
linux-unionfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 1/8] 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: David Howells <dhowells@...hat.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 308379b2d0b2..21079d1ca2aa 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -343,31 +343,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 = {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists