aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/afs/internal.h12
-rw-r--r--fs/cachefiles/internal.h13
-rw-r--r--fs/file_table.c9
-rw-r--r--fs/fs-writeback.c81
-rw-r--r--fs/fscache/internal.h14
-rw-r--r--fs/nfs/callback.c11
-rw-r--r--fs/notify/fanotify/fanotify.c8
-rw-r--r--fs/notify/fanotify/fanotify_user.c6
-rw-r--r--fs/notify/fsnotify.c12
-rw-r--r--fs/notify/inotify/inotify_fsnotify.c12
-rw-r--r--fs/notify/notification.c33
11 files changed, 77 insertions, 134 deletions
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index ce12a2b06f8f..cca8eef736fc 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -759,12 +759,6 @@ extern unsigned afs_debug;
759#define dbgprintk(FMT,...) \ 759#define dbgprintk(FMT,...) \
760 printk("[%-6.6s] "FMT"\n", current->comm ,##__VA_ARGS__) 760 printk("[%-6.6s] "FMT"\n", current->comm ,##__VA_ARGS__)
761 761
762/* make sure we maintain the format strings, even when debugging is disabled */
763static inline __attribute__((format(printf,1,2)))
764void _dbprintk(const char *fmt, ...)
765{
766}
767
768#define kenter(FMT,...) dbgprintk("==> %s("FMT")",__func__ ,##__VA_ARGS__) 762#define kenter(FMT,...) dbgprintk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
769#define kleave(FMT,...) dbgprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__) 763#define kleave(FMT,...) dbgprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
770#define kdebug(FMT,...) dbgprintk(" "FMT ,##__VA_ARGS__) 764#define kdebug(FMT,...) dbgprintk(" "FMT ,##__VA_ARGS__)
@@ -799,9 +793,9 @@ do { \
799} while (0) 793} while (0)
800 794
801#else 795#else
802#define _enter(FMT,...) _dbprintk("==> %s("FMT")",__func__ ,##__VA_ARGS__) 796#define _enter(FMT,...) no_printk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
803#define _leave(FMT,...) _dbprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__) 797#define _leave(FMT,...) no_printk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
804#define _debug(FMT,...) _dbprintk(" "FMT ,##__VA_ARGS__) 798#define _debug(FMT,...) no_printk(" "FMT ,##__VA_ARGS__)
805#endif 799#endif
806 800
807/* 801/*
diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h
index a8cd821226da..bd6bc1bde2d7 100644
--- a/fs/cachefiles/internal.h
+++ b/fs/cachefiles/internal.h
@@ -267,13 +267,6 @@ do { \
267#define dbgprintk(FMT, ...) \ 267#define dbgprintk(FMT, ...) \
268 printk(KERN_DEBUG "[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__) 268 printk(KERN_DEBUG "[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__)
269 269
270/* make sure we maintain the format strings, even when debugging is disabled */
271static inline void _dbprintk(const char *fmt, ...)
272 __attribute__((format(printf, 1, 2)));
273static inline void _dbprintk(const char *fmt, ...)
274{
275}
276
277#define kenter(FMT, ...) dbgprintk("==> %s("FMT")", __func__, ##__VA_ARGS__) 270#define kenter(FMT, ...) dbgprintk("==> %s("FMT")", __func__, ##__VA_ARGS__)
278#define kleave(FMT, ...) dbgprintk("<== %s()"FMT"", __func__, ##__VA_ARGS__) 271#define kleave(FMT, ...) dbgprintk("<== %s()"FMT"", __func__, ##__VA_ARGS__)
279#define kdebug(FMT, ...) dbgprintk(FMT, ##__VA_ARGS__) 272#define kdebug(FMT, ...) dbgprintk(FMT, ##__VA_ARGS__)
@@ -304,9 +297,9 @@ do { \
304} while (0) 297} while (0)
305 298
306#else 299#else
307#define _enter(FMT, ...) _dbprintk("==> %s("FMT")", __func__, ##__VA_ARGS__) 300#define _enter(FMT, ...) no_printk("==> %s("FMT")", __func__, ##__VA_ARGS__)
308#define _leave(FMT, ...) _dbprintk("<== %s()"FMT"", __func__, ##__VA_ARGS__) 301#define _leave(FMT, ...) no_printk("<== %s()"FMT"", __func__, ##__VA_ARGS__)
309#define _debug(FMT, ...) _dbprintk(FMT, ##__VA_ARGS__) 302#define _debug(FMT, ...) no_printk(FMT, ##__VA_ARGS__)
310#endif 303#endif
311 304
312#if 1 /* defined(__KDEBUGALL) */ 305#if 1 /* defined(__KDEBUGALL) */
diff --git a/fs/file_table.c b/fs/file_table.c
index 2fc3b3c08911..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.
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 2f76c4a081a2..7d9d06ba184b 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -68,7 +68,7 @@ int nr_pdflush_threads;
68 */ 68 */
69int writeback_in_progress(struct backing_dev_info *bdi) 69int writeback_in_progress(struct backing_dev_info *bdi)
70{ 70{
71 return !list_empty(&bdi->work_list); 71 return test_bit(BDI_writeback_running, &bdi->state);
72} 72}
73 73
74static void bdi_queue_work(struct backing_dev_info *bdi, 74static void bdi_queue_work(struct backing_dev_info *bdi,
@@ -249,10 +249,18 @@ static void move_expired_inodes(struct list_head *delaying_queue,
249 249
250/* 250/*
251 * Queue all expired dirty inodes for io, eldest first. 251 * Queue all expired dirty inodes for io, eldest first.
252 * Before
253 * newly dirtied b_dirty b_io b_more_io
254 * =============> gf edc BA
255 * After
256 * newly dirtied b_dirty b_io b_more_io
257 * =============> g fBAedc
258 * |
259 * +--> dequeue for IO
252 */ 260 */
253static void queue_io(struct bdi_writeback *wb, unsigned long *older_than_this) 261static void queue_io(struct bdi_writeback *wb, unsigned long *older_than_this)
254{ 262{
255 list_splice_init(&wb->b_more_io, wb->b_io.prev); 263 list_splice_init(&wb->b_more_io, &wb->b_io);
256 move_expired_inodes(&wb->b_dirty, &wb->b_io, older_than_this); 264 move_expired_inodes(&wb->b_dirty, &wb->b_io, older_than_this);
257} 265}
258 266
@@ -363,62 +371,35 @@ writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
363 spin_lock(&inode_lock); 371 spin_lock(&inode_lock);
364 inode->i_state &= ~I_SYNC; 372 inode->i_state &= ~I_SYNC;
365 if (!(inode->i_state & I_FREEING)) { 373 if (!(inode->i_state & I_FREEING)) {
366 if ((inode->i_state & I_DIRTY_PAGES) && wbc->for_kupdate) { 374 if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {
367 /*
368 * More pages get dirtied by a fast dirtier.
369 */
370 goto select_queue;
371 } else if (inode->i_state & I_DIRTY) {
372 /*
373 * At least XFS will redirty the inode during the
374 * writeback (delalloc) and on io completion (isize).
375 */
376 redirty_tail(inode);
377 } else if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) {
378 /* 375 /*
379 * We didn't write back all the pages. nfs_writepages() 376 * We didn't write back all the pages. nfs_writepages()
380 * sometimes bales out without doing anything. Redirty 377 * sometimes bales out without doing anything.
381 * the inode; Move it from b_io onto b_more_io/b_dirty.
382 */ 378 */
383 /* 379 inode->i_state |= I_DIRTY_PAGES;
384 * akpm: if the caller was the kupdate function we put 380 if (wbc->nr_to_write <= 0) {
385 * this inode at the head of b_dirty so it gets first
386 * consideration. Otherwise, move it to the tail, for
387 * the reasons described there. I'm not really sure
388 * how much sense this makes. Presumably I had a good
389 * reasons for doing it this way, and I'd rather not
390 * muck with it at present.
391 */
392 if (wbc->for_kupdate) {
393 /* 381 /*
394 * For the kupdate function we move the inode 382 * slice used up: queue for next turn
395 * to b_more_io so it will get more writeout as
396 * soon as the queue becomes uncongested.
397 */ 383 */
398 inode->i_state |= I_DIRTY_PAGES; 384 requeue_io(inode);
399select_queue:
400 if (wbc->nr_to_write <= 0) {
401 /*
402 * slice used up: queue for next turn
403 */
404 requeue_io(inode);
405 } else {
406 /*
407 * somehow blocked: retry later
408 */
409 redirty_tail(inode);
410 }
411 } else { 385 } else {
412 /* 386 /*
413 * Otherwise fully redirty the inode so that 387 * Writeback blocked by something other than
414 * other inodes on this superblock will get some 388 * congestion. Delay the inode for some time to
415 * writeout. Otherwise heavy writing to one 389 * avoid spinning on the CPU (100% iowait)
416 * file would indefinitely suspend writeout of 390 * retrying writeback of the dirty page/inode
417 * all the other files. 391 * that cannot be performed immediately.
418 */ 392 */
419 inode->i_state |= I_DIRTY_PAGES;
420 redirty_tail(inode); 393 redirty_tail(inode);
421 } 394 }
395 } else if (inode->i_state & I_DIRTY) {
396 /*
397 * Filesystems can dirty the inode during writeback
398 * operations, such as delayed allocation during
399 * submission or metadata updates after data IO
400 * completion.
401 */
402 redirty_tail(inode);
422 } else if (atomic_read(&inode->i_count)) { 403 } else if (atomic_read(&inode->i_count)) {
423 /* 404 /*
424 * The inode is clean, inuse 405 * The inode is clean, inuse
@@ -590,7 +571,7 @@ static inline bool over_bground_thresh(void)
590{ 571{
591 unsigned long background_thresh, dirty_thresh; 572 unsigned long background_thresh, dirty_thresh;
592 573
593 get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL); 574 global_dirty_limits(&background_thresh, &dirty_thresh);
594 575
595 return (global_page_state(NR_FILE_DIRTY) + 576 return (global_page_state(NR_FILE_DIRTY) +
596 global_page_state(NR_UNSTABLE_NFS) >= background_thresh); 577 global_page_state(NR_UNSTABLE_NFS) >= background_thresh);
@@ -759,6 +740,7 @@ long wb_do_writeback(struct bdi_writeback *wb, int force_wait)
759 struct wb_writeback_work *work; 740 struct wb_writeback_work *work;
760 long wrote = 0; 741 long wrote = 0;
761 742
743 set_bit(BDI_writeback_running, &wb->bdi->state);
762 while ((work = get_next_work_item(bdi)) != NULL) { 744 while ((work = get_next_work_item(bdi)) != NULL) {
763 /* 745 /*
764 * Override sync mode, in case we must wait for completion 746 * Override sync mode, in case we must wait for completion
@@ -785,6 +767,7 @@ long wb_do_writeback(struct bdi_writeback *wb, int force_wait)
785 * Check for periodic writeback, kupdated() style 767 * Check for periodic writeback, kupdated() style
786 */ 768 */
787 wrote += wb_check_old_data_flush(wb); 769 wrote += wb_check_old_data_flush(wb);
770 clear_bit(BDI_writeback_running, &wb->bdi->state);
788 771
789 return wrote; 772 return wrote;
790} 773}
diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h
index 6a026441c5a6..f6aad48d38a8 100644
--- a/fs/fscache/internal.h
+++ b/fs/fscache/internal.h
@@ -321,17 +321,11 @@ void fscache_put_context(struct fscache_cookie *cookie, void *context)
321#define dbgprintk(FMT, ...) \ 321#define dbgprintk(FMT, ...) \
322 printk(KERN_DEBUG "[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__) 322 printk(KERN_DEBUG "[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__)
323 323
324/* make sure we maintain the format strings, even when debugging is disabled */
325static inline __attribute__((format(printf, 1, 2)))
326void _dbprintk(const char *fmt, ...)
327{
328}
329
330#define kenter(FMT, ...) dbgprintk("==> %s("FMT")", __func__, ##__VA_ARGS__) 324#define kenter(FMT, ...) dbgprintk("==> %s("FMT")", __func__, ##__VA_ARGS__)
331#define kleave(FMT, ...) dbgprintk("<== %s()"FMT"", __func__, ##__VA_ARGS__) 325#define kleave(FMT, ...) dbgprintk("<== %s()"FMT"", __func__, ##__VA_ARGS__)
332#define kdebug(FMT, ...) dbgprintk(FMT, ##__VA_ARGS__) 326#define kdebug(FMT, ...) dbgprintk(FMT, ##__VA_ARGS__)
333 327
334#define kjournal(FMT, ...) _dbprintk(FMT, ##__VA_ARGS__) 328#define kjournal(FMT, ...) no_printk(FMT, ##__VA_ARGS__)
335 329
336#ifdef __KDEBUG 330#ifdef __KDEBUG
337#define _enter(FMT, ...) kenter(FMT, ##__VA_ARGS__) 331#define _enter(FMT, ...) kenter(FMT, ##__VA_ARGS__)
@@ -358,9 +352,9 @@ do { \
358} while (0) 352} while (0)
359 353
360#else 354#else
361#define _enter(FMT, ...) _dbprintk("==> %s("FMT")", __func__, ##__VA_ARGS__) 355#define _enter(FMT, ...) no_printk("==> %s("FMT")", __func__, ##__VA_ARGS__)
362#define _leave(FMT, ...) _dbprintk("<== %s()"FMT"", __func__, ##__VA_ARGS__) 356#define _leave(FMT, ...) no_printk("<== %s()"FMT"", __func__, ##__VA_ARGS__)
363#define _debug(FMT, ...) _dbprintk(FMT, ##__VA_ARGS__) 357#define _debug(FMT, ...) no_printk(FMT, ##__VA_ARGS__)
364#endif 358#endif
365 359
366/* 360/*
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 36dfdae95123..e17b49e2eabd 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -45,7 +45,7 @@ unsigned short nfs_callback_tcpport;
45unsigned short nfs_callback_tcpport6; 45unsigned short nfs_callback_tcpport6;
46#define NFS_CALLBACK_MAXPORTNR (65535U) 46#define NFS_CALLBACK_MAXPORTNR (65535U)
47 47
48static int param_set_portnr(const char *val, struct kernel_param *kp) 48static int param_set_portnr(const char *val, const struct kernel_param *kp)
49{ 49{
50 unsigned long num; 50 unsigned long num;
51 int ret; 51 int ret;
@@ -58,11 +58,10 @@ static int param_set_portnr(const char *val, struct kernel_param *kp)
58 *((unsigned int *)kp->arg) = num; 58 *((unsigned int *)kp->arg) = num;
59 return 0; 59 return 0;
60} 60}
61 61static struct kernel_param_ops param_ops_portnr = {
62static int param_get_portnr(char *buffer, struct kernel_param *kp) 62 .set = param_set_portnr,
63{ 63 .get = param_get_uint,
64 return param_get_uint(buffer, kp); 64};
65}
66#define param_check_portnr(name, p) __param_check(name, p, unsigned int); 65#define param_check_portnr(name, p) __param_check(name, p, unsigned int);
67 66
68module_param_named(callback_tcpport, nfs_callback_set_tcpport, portnr, 0644); 67module_param_named(callback_tcpport, nfs_callback_set_tcpport, portnr, 0644);
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index eb8f73c9c131..756566fe8449 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -17,9 +17,9 @@ static bool should_merge(struct fsnotify_event *old, struct fsnotify_event *new)
17 old->data_type == new->data_type && 17 old->data_type == new->data_type &&
18 old->tgid == new->tgid) { 18 old->tgid == new->tgid) {
19 switch (old->data_type) { 19 switch (old->data_type) {
20 case (FSNOTIFY_EVENT_FILE): 20 case (FSNOTIFY_EVENT_PATH):
21 if ((old->file->f_path.mnt == new->file->f_path.mnt) && 21 if ((old->path.mnt == new->path.mnt) &&
22 (old->file->f_path.dentry == new->file->f_path.dentry)) 22 (old->path.dentry == new->path.dentry))
23 return true; 23 return true;
24 case (FSNOTIFY_EVENT_NONE): 24 case (FSNOTIFY_EVENT_NONE):
25 return true; 25 return true;
@@ -174,7 +174,7 @@ static bool fanotify_should_send_event(struct fsnotify_group *group,
174 return false; 174 return false;
175 175
176 /* if we don't have enough info to send an event to userspace say no */ 176 /* if we don't have enough info to send an event to userspace say no */
177 if (data_type != FSNOTIFY_EVENT_FILE) 177 if (data_type != FSNOTIFY_EVENT_PATH)
178 return false; 178 return false;
179 179
180 if (inode_mark && vfsmnt_mark) { 180 if (inode_mark && vfsmnt_mark) {
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 25a3b4dfcf61..032b837fcd11 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -65,7 +65,7 @@ static int create_fd(struct fsnotify_group *group, struct fsnotify_event *event)
65 if (client_fd < 0) 65 if (client_fd < 0)
66 return client_fd; 66 return client_fd;
67 67
68 if (event->data_type != FSNOTIFY_EVENT_FILE) { 68 if (event->data_type != FSNOTIFY_EVENT_PATH) {
69 WARN_ON(1); 69 WARN_ON(1);
70 put_unused_fd(client_fd); 70 put_unused_fd(client_fd);
71 return -EINVAL; 71 return -EINVAL;
@@ -75,8 +75,8 @@ static int create_fd(struct fsnotify_group *group, struct fsnotify_event *event)
75 * we need a new file handle for the userspace program so it can read even if it was 75 * we need a new file handle for the userspace program so it can read even if it was
76 * originally opened O_WRONLY. 76 * originally opened O_WRONLY.
77 */ 77 */
78 dentry = dget(event->file->f_path.dentry); 78 dentry = dget(event->path.dentry);
79 mnt = mntget(event->file->f_path.mnt); 79 mnt = mntget(event->path.mnt);
80 /* it's possible this event was an overflow event. in that case dentry and mnt 80 /* it's possible this event was an overflow event. in that case dentry and mnt
81 * are NULL; That's fine, just don't call dentry open */ 81 * are NULL; That's fine, just don't call dentry open */
82 if (dentry && mnt) 82 if (dentry && mnt)
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index 4d2a82c1ceb1..3970392b2722 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -84,7 +84,7 @@ void __fsnotify_update_child_dentry_flags(struct inode *inode)
84} 84}
85 85
86/* Notify this dentry's parent about a child's events. */ 86/* Notify this dentry's parent about a child's events. */
87void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask) 87void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask)
88{ 88{
89 struct dentry *parent; 89 struct dentry *parent;
90 struct inode *p_inode; 90 struct inode *p_inode;
@@ -92,7 +92,7 @@ void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask)
92 bool should_update_children = false; 92 bool should_update_children = false;
93 93
94 if (!dentry) 94 if (!dentry)
95 dentry = file->f_path.dentry; 95 dentry = path->dentry;
96 96
97 if (!(dentry->d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED)) 97 if (!(dentry->d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED))
98 return; 98 return;
@@ -124,8 +124,8 @@ void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask)
124 * specifies these are events which came from a child. */ 124 * specifies these are events which came from a child. */
125 mask |= FS_EVENT_ON_CHILD; 125 mask |= FS_EVENT_ON_CHILD;
126 126
127 if (file) 127 if (path)
128 fsnotify(p_inode, mask, file, FSNOTIFY_EVENT_FILE, 128 fsnotify(p_inode, mask, path, FSNOTIFY_EVENT_PATH,
129 dentry->d_name.name, 0); 129 dentry->d_name.name, 0);
130 else 130 else
131 fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE, 131 fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE,
@@ -217,8 +217,8 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
217 /* global tests shouldn't care about events on child only the specific event */ 217 /* global tests shouldn't care about events on child only the specific event */
218 __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD); 218 __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD);
219 219
220 if (data_is == FSNOTIFY_EVENT_FILE) 220 if (data_is == FSNOTIFY_EVENT_PATH)
221 mnt = ((struct file *)data)->f_path.mnt; 221 mnt = ((struct path *)data)->mnt;
222 else 222 else
223 mnt = NULL; 223 mnt = NULL;
224 224
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index 5e73eeb2c697..a91b69a6a291 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -52,9 +52,9 @@ static bool event_compare(struct fsnotify_event *old, struct fsnotify_event *new
52 !strcmp(old->file_name, new->file_name)) 52 !strcmp(old->file_name, new->file_name))
53 return true; 53 return true;
54 break; 54 break;
55 case (FSNOTIFY_EVENT_FILE): 55 case (FSNOTIFY_EVENT_PATH):
56 if ((old->file->f_path.mnt == new->file->f_path.mnt) && 56 if ((old->path.mnt == new->path.mnt) &&
57 (old->file->f_path.dentry == new->file->f_path.dentry)) 57 (old->path.dentry == new->path.dentry))
58 return true; 58 return true;
59 break; 59 break;
60 case (FSNOTIFY_EVENT_NONE): 60 case (FSNOTIFY_EVENT_NONE):
@@ -147,10 +147,10 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode
147 __u32 mask, void *data, int data_type) 147 __u32 mask, void *data, int data_type)
148{ 148{
149 if ((inode_mark->mask & FS_EXCL_UNLINK) && 149 if ((inode_mark->mask & FS_EXCL_UNLINK) &&
150 (data_type == FSNOTIFY_EVENT_FILE)) { 150 (data_type == FSNOTIFY_EVENT_PATH)) {
151 struct file *file = data; 151 struct path *path = data;
152 152
153 if (d_unlinked(file->f_path.dentry)) 153 if (d_unlinked(path->dentry))
154 return false; 154 return false;
155 } 155 }
156 156
diff --git a/fs/notify/notification.c b/fs/notify/notification.c
index d6c435adc7a2..f39260f8f865 100644
--- a/fs/notify/notification.c
+++ b/fs/notify/notification.c
@@ -31,7 +31,6 @@
31 * allocated and used. 31 * allocated and used.
32 */ 32 */
33 33
34#include <linux/file.h>
35#include <linux/fs.h> 34#include <linux/fs.h>
36#include <linux/init.h> 35#include <linux/init.h>
37#include <linux/kernel.h> 36#include <linux/kernel.h>
@@ -90,8 +89,8 @@ void fsnotify_put_event(struct fsnotify_event *event)
90 if (atomic_dec_and_test(&event->refcnt)) { 89 if (atomic_dec_and_test(&event->refcnt)) {
91 pr_debug("%s: event=%p\n", __func__, event); 90 pr_debug("%s: event=%p\n", __func__, event);
92 91
93 if (event->data_type == FSNOTIFY_EVENT_FILE) 92 if (event->data_type == FSNOTIFY_EVENT_PATH)
94 fput(event->file); 93 path_put(&event->path);
95 94
96 BUG_ON(!list_empty(&event->private_data_list)); 95 BUG_ON(!list_empty(&event->private_data_list));
97 96
@@ -376,8 +375,8 @@ struct fsnotify_event *fsnotify_clone_event(struct fsnotify_event *old_event)
376 } 375 }
377 } 376 }
378 event->tgid = get_pid(old_event->tgid); 377 event->tgid = get_pid(old_event->tgid);
379 if (event->data_type == FSNOTIFY_EVENT_FILE) 378 if (event->data_type == FSNOTIFY_EVENT_PATH)
380 get_file(event->file); 379 path_get(&event->path);
381 380
382 return event; 381 return event;
383} 382}
@@ -424,22 +423,11 @@ struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
424 event->data_type = data_type; 423 event->data_type = data_type;
425 424
426 switch (data_type) { 425 switch (data_type) {
427 case FSNOTIFY_EVENT_FILE: { 426 case FSNOTIFY_EVENT_PATH: {
428 event->file = data; 427 struct path *path = data;
429 /* 428 event->path.dentry = path->dentry;
430 * if this file is about to disappear hold an extra reference 429 event->path.mnt = path->mnt;
431 * until we return to __fput so we don't have to worry about 430 path_get(&event->path);
432 * future get/put destroying the file under us or generating
433 * additional events. Notice that we change f_mode without
434 * holding f_lock. This is safe since this is the only possible
435 * reference to this object in the kernel (it was about to be
436 * freed, remember?)
437 */
438 if (!atomic_long_read(&event->file->f_count)) {
439 event->file->f_mode |= FMODE_NONOTIFY;
440 get_file(event->file);
441 }
442 get_file(event->file);
443 break; 431 break;
444 } 432 }
445 case FSNOTIFY_EVENT_INODE: 433 case FSNOTIFY_EVENT_INODE:
@@ -447,7 +435,8 @@ struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
447 break; 435 break;
448 case FSNOTIFY_EVENT_NONE: 436 case FSNOTIFY_EVENT_NONE:
449 event->inode = NULL; 437 event->inode = NULL;
450 event->file = NULL; 438 event->path.dentry = NULL;
439 event->path.mnt = NULL;
451 break; 440 break;
452 default: 441 default:
453 BUG(); 442 BUG();