summaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-07-09 08:35:08 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2018-07-12 16:04:16 +0200
commitf5d11409e61dadf1f9af91b22bbedc28a60a2e2c (patch)
tree5d965549f3a50f712e6b6fc3e2e908dda385493d /fs/open.c
parent->file_open(): lose cred argument (diff)
downloadlinux-f5d11409e61dadf1f9af91b22bbedc28a60a2e2c.tar.xz
linux-f5d11409e61dadf1f9af91b22bbedc28a60a2e2c.zip
introduce FMODE_OPENED
basically, "is that instance set up enough for regular fput(), or do we want put_filp() for that one". NOTE: the only alloc_file() caller that could be followed by put_filp() is in arch/ia64/kernel/perfmon.c, which is (Kconfig-level) broken. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/open.c b/fs/open.c
index 4c65edefa487..f3c6cb6a57b9 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -749,7 +749,7 @@ static int do_dentry_open(struct file *f,
f->f_wb_err = filemap_sample_wb_err(f->f_mapping);
if (unlikely(f->f_flags & O_PATH)) {
- f->f_mode = FMODE_PATH;
+ f->f_mode = FMODE_PATH | FMODE_OPENED;
f->f_op = &empty_fops;
return 0;
}
@@ -793,6 +793,7 @@ static int do_dentry_open(struct file *f,
if (error)
goto cleanup_all;
}
+ f->f_mode |= FMODE_OPENED;
if ((f->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ)
i_readcount_inc(inode);
if ((f->f_mode & FMODE_READ) &&