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.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/file_table.c b/fs/file_table.c
index b8a0bb63cbd7..edecd36fed9b 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -230,15 +230,6 @@ static void __fput(struct file *file)
230 might_sleep(); 230 might_sleep();
231 231
232 fsnotify_close(file); 232 fsnotify_close(file);
233
234 /*
235 * fsnotify_create_event may have taken one or more references on this
236 * file. If it did so it left one reference for us to drop to make sure
237 * its calls to fput could not prematurely destroy the file.
238 */
239 if (atomic_long_read(&file->f_count))
240 return fput(file);
241
242 /* 233 /*
243 * The function eventpoll_release() should be the first called 234 * The function eventpoll_release() should be the first called
244 * in the file cleanup chain. 235 * in the file cleanup chain.
@@ -298,11 +289,20 @@ struct file *fget(unsigned int fd)
298EXPORT_SYMBOL(fget); 289EXPORT_SYMBOL(fget);
299 290
300/* 291/*
301 * Lightweight file lookup - no refcnt increment if fd table isn't shared. 292 * Lightweight file lookup - no refcnt increment if fd table isn't shared.
302 * You can use this only if it is guranteed that the current task already 293 *
303 * holds a refcnt to that file. That check has to be done at fget() only 294 * You can use this instead of fget if you satisfy all of the following
304 * and a flag is returned to be passed to the corresponding fput_light(). 295 * conditions:
305 * There must not be a cloning between an fget_light/fput_light pair. 296 * 1) You must call fput_light before exiting the syscall and returning control
297 * to userspace (i.e. you cannot remember the returned struct file * after
298 * returning to userspace).
299 * 2) You must not call filp_close on the returned struct file * in between
300 * calls to fget_light and fput_light.
301 * 3) You must not clone the current task in between the calls to fget_light
302 * and fput_light.
303 *
304 * The fput_needed flag returned by fget_light should be passed to the
305 * corresponding fput_light.
306 */ 306 */
307struct file *fget_light(unsigned int fd, int *fput_needed) 307struct file *fget_light(unsigned int fd, int *fput_needed)
308{ 308{