path.mnt = mntget(anon_inode_mnt);- /*- * We know the anon_inode inode count is always greater than zero,- * so we can avoid doing an igrab() and we can use an open-coded- * atomic_inc().- */- atomic_inc(&anon_inode_inode->i_count);+ iref(anon_inode_inode);

/* * Write out an inode's dirty pages. Called under inode_lock. Either the- * caller has ref on the inode (either via __iget or via syscall against an fd)- * or the inode has I_WILL_FREE set (via generic_forget_inode)+ * caller has a reference on the inode or the inode has I_WILL_FREE set. * * If `wait' is set, wait on the writeout. *@@ -500,7 +499,7 @@ static int writeback_sb_inodes(struct super_block *sb, struct bdi_writeback *wb, return 1;

-/*- * inode_lock must be held+/**+ * iref - increment the reference count on an inode+ * @inode: inode to take a reference on+ *+ * iref() should be called to take an extra reference to an inode. The inode+ * must already have a reference count obtained via igrab() as iref() does not+ * do checks for the inode being freed and hence cannot be used to initially+ * obtain a reference to the inode. */-void __iget(struct inode *inode)+void iref(struct inode *inode) {+ WARN_ON(atomic_read(&inode->i_count) < 1);+ spin_lock(&inode_lock); atomic_inc(&inode->i_count);+ spin_unlock(&inode_lock); }+EXPORT_SYMBOL_GPL(iref);

/*- * We cannot __iget() an inode in state I_FREEING,+ * We cannot iref() 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. */@@ -253,7 +253,7 @@ void fsnotify_unmount_inodes(struct list_head *list)

/* * If i_count is zero, the inode cannot have any watches and- * doing an __iget/iput with MS_ACTIVE clear would actually+ * doing an iref/iput with MS_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. */@@ -265,7 +265,7 @@ void fsnotify_unmount_inodes(struct list_head *list)