diff options
Diffstat (limited to 'fs/internal.h')
-rw-r--r-- | fs/internal.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/internal.h b/fs/internal.h index 87e96b9024ce..31861e6c3eff 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -101,6 +101,16 @@ extern void chroot_fs_refs(const struct path *, const struct path *); extern struct file *alloc_empty_file(int, const struct cred *); extern struct file *alloc_empty_file_noaccount(int, const struct cred *); +static inline void put_file_access(struct file *file) +{ + if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { + i_readcount_dec(file->f_inode); + } else if (file->f_mode & FMODE_WRITER) { + put_write_access(file->f_inode); + __mnt_drop_write(file->f_path.mnt); + } +} + /* * super.c */ |