mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]>
This commit is contained in:
parent
0ccb286346
commit
83f936c75e
4 changed files with 11 additions and 41 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue