summaryrefslogtreecommitdiffstats
path: root/fs/file_table.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-07-11 15:00:04 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-07-12 10:04:13 -0400
commitea73ea7279884ba80896d4ea0f0443bf48b9e311 (patch)
tree4fd72a8f638d6c502ccb595e179a453819e18ded /fs/file_table.c
parent6de37b6dc085e7c5e092b69289af66876526da44 (diff)
downloadlinux-ea73ea7279884ba80896d4ea0f0443bf48b9e311.tar.gz
linux-ea73ea7279884ba80896d4ea0f0443bf48b9e311.tar.bz2
linux-ea73ea7279884ba80896d4ea0f0443bf48b9e311.zip
pass ->f_flags value to alloc_empty_file()
... and have it set the f_flags-derived part of ->f_mode. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/file_table.c')
-rw-r--r--fs/file_table.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/file_table.c b/fs/file_table.c
index 76cfa4c43e13..705f486f7007 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -101,7 +101,7 @@ int proc_nr_files(struct ctl_table *table, int write,
* done, you will imbalance int the mount's writer count
* and a warning at __fput() time.
*/
-struct file *alloc_empty_file(const struct cred *cred)
+struct file *alloc_empty_file(int flags, const struct cred *cred)
{
static long old_max;
struct file *f;
@@ -135,6 +135,8 @@ struct file *alloc_empty_file(const struct cred *cred)
spin_lock_init(&f->f_lock);
mutex_init(&f->f_pos_lock);
eventpoll_init_file(f);
+ f->f_flags = flags;
+ f->f_mode = OPEN_FMODE(flags);
/* f->f_version: 0 */
percpu_counter_inc(&nr_files);
return f;
@@ -160,12 +162,10 @@ struct file *alloc_file(const struct path *path, int flags,
{
struct file *file;
- file = alloc_empty_file(current_cred());
+ file = alloc_empty_file(flags, current_cred());
if (IS_ERR(file))
return file;
- file->f_mode = OPEN_FMODE(flags);
- file->f_flags = flags;
file->f_path = *path;
file->f_inode = path->dentry->d_inode;
file->f_mapping = path->dentry->d_inode->i_mapping;