We can now just use igrab() to make sure we've got a live inode and remove the I_WILL_FREE|I_FREEING checks. Signed-off-by: Josef Bacik --- fs/notify/fsnotify.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 46bfc543f946..25996ad2a130 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c @@ -46,33 +46,15 @@ static void fsnotify_unmount_inodes(struct super_block *sb) spin_lock(&sb->s_inode_list_lock); list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { - /* - * We cannot __iget() an inode in state I_FREEING, - * I_WILL_FREE, or I_NEW which is fine because by that point - * the inode cannot have any associated watches. - */ spin_lock(&inode->i_lock); - if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) { + if (inode->i_state & I_NEW) { spin_unlock(&inode->i_lock); continue; } - - /* - * If i_count is zero, the inode cannot have any watches and - * doing an __iget/iput with SB_ACTIVE clear would actually - * evict all inodes with zero i_count from icache which is - * unnecessarily violent and may in fact be illegal to do. - * However, we should have been called /after/ evict_inodes - * removed all zero refcount inodes, in any case. Test to - * be sure. - */ - if (!icount_read(inode)) { - spin_unlock(&inode->i_lock); - continue; - } - - __iget(inode); spin_unlock(&inode->i_lock); + + if (!igrab(inode)) + continue; spin_unlock(&sb->s_inode_list_lock); iput(iput_inode); -- 2.49.0