diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-03-14 12:02:47 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-04-01 23:19:12 -0400 |
commit | 83f936c75e3689a63253d89c47a4d239c56d7410 (patch) | |
tree | 430d89096a9b56ffb8e80bd4febde39e1d05ad4c /fs/open.c | |
parent | 0ccb286346c4c0644be17f04a9eb23ad99262882 (diff) |
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.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -670,6 +670,7 @@ static int do_dentry_open(struct file *f, | |||
670 | put_write_access(inode); | 670 | put_write_access(inode); |
671 | goto cleanup_file; | 671 | goto cleanup_file; |
672 | } | 672 | } |
673 | f->f_mode |= FMODE_WRITER; | ||
673 | } | 674 | } |
674 | 675 | ||
675 | f->f_mapping = inode->i_mapping; | 676 | f->f_mapping = inode->i_mapping; |
@@ -715,11 +716,9 @@ static int do_dentry_open(struct file *f, | |||
715 | 716 | ||
716 | cleanup_all: | 717 | cleanup_all: |
717 | fops_put(f->f_op); | 718 | fops_put(f->f_op); |
718 | if (f->f_mode & FMODE_WRITE) { | 719 | if (f->f_mode & FMODE_WRITER) { |
719 | if (!special_file(inode->i_mode)) { | 720 | put_write_access(inode); |
720 | put_write_access(inode); | 721 | __mnt_drop_write(f->f_path.mnt); |
721 | __mnt_drop_write(f->f_path.mnt); | ||
722 | } | ||
723 | } | 722 | } |
724 | cleanup_file: | 723 | cleanup_file: |
725 | path_put(&f->f_path); | 724 | path_put(&f->f_path); |