aboutsummaryrefslogtreecommitdiffstats
path: root/fs/notify
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2009-03-11 16:17:36 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-03-27 14:44:05 -0400
commitaabb8fdb41128705fd1627f56fdd571e45fdbcdb (patch)
treebae6e9abf167cf20b9a2d3e5c38520d3f17b777d /fs/notify
parent1bd7903560f1f713e85188a5aaf4d2428b6c8b50 (diff)
fs: avoid I_NEW inodes
To be on the safe side, it should be less fragile to exclude I_NEW inodes from inode list scans by default (unless there is an important reason to have them). Normally they will get excluded (eg. by zero refcount or writecount etc), however it is a bit fragile for list walkers to know exactly what parts of the inode state is set up and valid to test when in I_NEW. So along these lines, move I_NEW checks upward as well (sometimes taking I_FREEING etc checks with them too -- this shouldn't be a problem should it?) Signed-off-by: Nick Piggin <npiggin@suse.de> Acked-by: Jan Kara <jack@suse.cz> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/notify')
-rw-r--r--fs/notify/inotify/inotify.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/notify/inotify/inotify.c b/fs/notify/inotify/inotify.c
index 331f2e88e284..220c13f0d73d 100644
--- a/fs/notify/inotify/inotify.c
+++ b/fs/notify/inotify/inotify.c
@@ -380,6 +380,14 @@ void inotify_unmount_inodes(struct list_head *list)
380 struct list_head *watches; 380 struct list_head *watches;
381 381
382 /* 382 /*
383 * We cannot __iget() an inode in state I_CLEAR, I_FREEING,
384 * I_WILL_FREE, or I_NEW which is fine because by that point
385 * the inode cannot have any associated watches.
386 */
387 if (inode->i_state & (I_CLEAR|I_FREEING|I_WILL_FREE|I_NEW))
388 continue;
389
390 /*
383 * If i_count is zero, the inode cannot have any watches and 391 * If i_count is zero, the inode cannot have any watches and
384 * doing an __iget/iput with MS_ACTIVE clear would actually 392 * doing an __iget/iput with MS_ACTIVE clear would actually
385 * evict all inodes with zero i_count from icache which is 393 * evict all inodes with zero i_count from icache which is
@@ -388,14 +396,6 @@ void inotify_unmount_inodes(struct list_head *list)
388 if (!atomic_read(&inode->i_count)) 396 if (!atomic_read(&inode->i_count))
389 continue; 397 continue;
390 398
391 /*
392 * We cannot __iget() an inode in state I_CLEAR, I_FREEING, or
393 * I_WILL_FREE which is fine because by that point the inode
394 * cannot have any associated watches.
395 */
396 if (inode->i_state & (I_CLEAR | I_FREEING | I_WILL_FREE))
397 continue;
398
399 need_iput_tmp = need_iput; 399 need_iput_tmp = need_iput;
400 need_iput = NULL; 400 need_iput = NULL;
401 /* In case inotify_remove_watch_locked() drops a reference. */ 401 /* In case inotify_remove_watch_locked() drops a reference. */