aboutsummaryrefslogtreecommitdiffstats
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, 5 insertions, 4 deletions
diff --git a/fs/file_table.c b/fs/file_table.c
index c3a5e2fd663b..768b58167543 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -16,6 +16,7 @@
16#include <linux/eventpoll.h> 16#include <linux/eventpoll.h>
17#include <linux/rcupdate.h> 17#include <linux/rcupdate.h>
18#include <linux/mount.h> 18#include <linux/mount.h>
19#include <linux/capability.h>
19#include <linux/cdev.h> 20#include <linux/cdev.h>
20#include <linux/fsnotify.h> 21#include <linux/fsnotify.h>
21 22
@@ -117,7 +118,7 @@ EXPORT_SYMBOL(get_empty_filp);
117 118
118void fastcall fput(struct file *file) 119void fastcall fput(struct file *file)
119{ 120{
120 if (rcuref_dec_and_test(&file->f_count)) 121 if (atomic_dec_and_test(&file->f_count))
121 __fput(file); 122 __fput(file);
122} 123}
123 124
@@ -166,7 +167,7 @@ struct file fastcall *fget(unsigned int fd)
166 rcu_read_lock(); 167 rcu_read_lock();
167 file = fcheck_files(files, fd); 168 file = fcheck_files(files, fd);
168 if (file) { 169 if (file) {
169 if (!rcuref_inc_lf(&file->f_count)) { 170 if (!atomic_inc_not_zero(&file->f_count)) {
170 /* File object ref couldn't be taken */ 171 /* File object ref couldn't be taken */
171 rcu_read_unlock(); 172 rcu_read_unlock();
172 return NULL; 173 return NULL;
@@ -198,7 +199,7 @@ struct file fastcall *fget_light(unsigned int fd, int *fput_needed)
198 rcu_read_lock(); 199 rcu_read_lock();
199 file = fcheck_files(files, fd); 200 file = fcheck_files(files, fd);
200 if (file) { 201 if (file) {
201 if (rcuref_inc_lf(&file->f_count)) 202 if (atomic_inc_not_zero(&file->f_count))
202 *fput_needed = 1; 203 *fput_needed = 1;
203 else 204 else
204 /* Didn't get the reference, someone's freed */ 205 /* Didn't get the reference, someone's freed */
@@ -213,7 +214,7 @@ struct file fastcall *fget_light(unsigned int fd, int *fput_needed)
213 214
214void put_filp(struct file *file) 215void put_filp(struct file *file)
215{ 216{
216 if (rcuref_dec_and_test(&file->f_count)) { 217 if (atomic_dec_and_test(&file->f_count)) {
217 security_file_free(file); 218 security_file_free(file);
218 file_kill(file); 219 file_kill(file);
219 file_free(file); 220 file_free(file);