summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro2014-03-14 14:43:29 +0100
committerAl Viro2014-04-02 05:19:13 +0200
commit3f4d5a00076b7e340625a2014cb83e10bf0d6dd1 (patch)
tree91e9d51a093c17a74b66bd0ad9034180e67a17a5 /fs
parentmark struct file that had write access grabbed by open() (diff)
downloadkernel-qcow2-linux-3f4d5a00076b7e340625a2014cb83e10bf0d6dd1.tar.gz
kernel-qcow2-linux-3f4d5a00076b7e340625a2014cb83e10bf0d6dd1.tar.xz
kernel-qcow2-linux-3f4d5a00076b7e340625a2014cb83e10bf0d6dd1.zip
tidy do_dentry_open() up a bit
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/open.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/fs/open.c b/fs/open.c
index dcefb2f02d10..37f65fa44dbf 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -656,30 +656,28 @@ static int do_dentry_open(struct file *f,
f->f_mode = OPEN_FMODE(f->f_flags) | FMODE_LSEEK |
FMODE_PREAD | FMODE_PWRITE;
- if (unlikely(f->f_flags & O_PATH))
- f->f_mode = FMODE_PATH;
-
path_get(&f->f_path);
inode = f->f_inode = f->f_path.dentry->d_inode;
+ f->f_mapping = inode->i_mapping;
+
+ if (unlikely(f->f_flags & O_PATH)) {
+ f->f_mode = FMODE_PATH;
+ f->f_op = &empty_fops;
+ return 0;
+ }
+
if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) {
error = get_write_access(inode);
- if (error)
+ if (unlikely(error))
goto cleanup_file;
error = __mnt_want_write(f->f_path.mnt);
- if (error) {
+ if (unlikely(error)) {
put_write_access(inode);
goto cleanup_file;
}
f->f_mode |= FMODE_WRITER;
}
- f->f_mapping = inode->i_mapping;
-
- if (unlikely(f->f_mode & FMODE_PATH)) {
- f->f_op = &empty_fops;
- return 0;
- }
-
/* POSIX.1-2008/SUSv4 Section XSI 2.9.7 */
if (S_ISREG(inode->i_mode))
f->f_mode |= FMODE_ATOMIC_POS;