summaryrefslogtreecommitdiffstats
path: root/fs/file_table.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/file_table.c')
-rw-r--r--fs/file_table.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/file_table.c b/fs/file_table.c
index 5679e7fcb6b0..155d7514a094 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -326,9 +326,9 @@ void flush_delayed_fput(void)
326 326
327static DECLARE_DELAYED_WORK(delayed_fput_work, delayed_fput); 327static DECLARE_DELAYED_WORK(delayed_fput_work, delayed_fput);
328 328
329void fput(struct file *file) 329void fput_many(struct file *file, unsigned int refs)
330{ 330{
331 if (atomic_long_dec_and_test(&file->f_count)) { 331 if (atomic_long_sub_and_test(refs, &file->f_count)) {
332 struct task_struct *task = current; 332 struct task_struct *task = current;
333 333
334 if (likely(!in_interrupt() && !(task->flags & PF_KTHREAD))) { 334 if (likely(!in_interrupt() && !(task->flags & PF_KTHREAD))) {
@@ -347,6 +347,11 @@ void fput(struct file *file)
347 } 347 }
348} 348}
349 349
350void fput(struct file *file)
351{
352 fput_many(file, 1);
353}
354
350/* 355/*
351 * synchronous analog of fput(); for kernel threads that might be needed 356 * synchronous analog of fput(); for kernel threads that might be needed
352 * in some umount() (and thus can't use flush_delayed_fput() without 357 * in some umount() (and thus can't use flush_delayed_fput() without