summaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-03-14 17:02:47 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2014-04-02 05:19:12 +0200
commit83f936c75e3689a63253d89c47a4d239c56d7410 (patch)
tree430d89096a9b56ffb8e80bd4febde39e1d05ad4c /fs/open.c
parentfold __get_file_write_access() into its only caller (diff)
downloadlinux-83f936c75e3689a63253d89c47a4d239c56d7410.tar.xz
linux-83f936c75e3689a63253d89c47a4d239c56d7410.zip
mark struct file that had write access grabbed by open()
new flag in ->f_mode - FMODE_WRITER. Set by do_dentry_open() in case when it has grabbed write access, checked by __fput() to decide whether it wants to drop the sucker. Allows to stop bothering with mnt_clone_write() in alloc_file(), along with fewer special_file() checks. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/open.c b/fs/open.c
index ebef0c5fa10c..dcefb2f02d10 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -670,6 +670,7 @@ static int do_dentry_open(struct file *f,
put_write_access(inode);
goto cleanup_file;
}
+ f->f_mode |= FMODE_WRITER;
}
f->f_mapping = inode->i_mapping;
@@ -715,11 +716,9 @@ static int do_dentry_open(struct file *f,
cleanup_all:
fops_put(f->f_op);
- if (f->f_mode & FMODE_WRITE) {
- if (!special_file(inode->i_mode)) {
- put_write_access(inode);
- __mnt_drop_write(f->f_path.mnt);
- }
+ if (f->f_mode & FMODE_WRITER) {
+ put_write_access(inode);
+ __mnt_drop_write(f->f_path.mnt);
}
cleanup_file:
path_put(&f->f_path);