Now that we have the reference count to check if the inode is live, use that instead of checking I_WILL_FREE|I_FREEING. Signed-off-by: Josef Bacik --- fs/gfs2/ops_fstype.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index c770006f8889..2b481fdc903d 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -1745,17 +1745,26 @@ static void gfs2_evict_inodes(struct super_block *sb) struct gfs2_sbd *sdp = sb->s_fs_info; set_bit(SDF_EVICTING, &sdp->sd_flags); - +again: spin_lock(&sb->s_inode_list_lock); list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { spin_lock(&inode->i_lock); - if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) && - !need_resched()) { + if ((inode->i_state & I_NEW) && !need_resched()) { spin_unlock(&inode->i_lock); continue; } - __iget(inode); spin_unlock(&inode->i_lock); + + if (!igrab(inode)) { + if (need_resched()) { + spin_unlock(&sb->s_inode_list_lock); + iput(toput_inode); + toput_inode = NULL; + cond_resched(); + goto again; + } + continue; + } spin_unlock(&sb->s_inode_list_lock); iput(toput_inode); -- 2.49.0