Skip to content

Commit f0c0ade

Browse files
author
Andreas Gruenbacher
committed
gfs2: Minor gfs2_try_evict cleanup
In gfs2_try_evict(), when an inode can't be evicted, we are grabbing a temporary reference on the inode glock to poke that glock. That should be safe, but it's easier to just grab an inode reference as we already do earlier in this function. Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 88f4a9f commit f0c0ade

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

fs/gfs2/glock.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,8 +1023,6 @@ static bool gfs2_try_evict(struct gfs2_glock *gl)
10231023
ip = NULL;
10241024
spin_unlock(&gl->gl_lockref.lock);
10251025
if (ip) {
1026-
struct gfs2_glock *inode_gl = NULL;
1027-
10281026
gl->gl_no_formal_ino = ip->i_no_formal_ino;
10291027
set_bit(GIF_DEFERRED_DELETE, &ip->i_flags);
10301028
d_prune_aliases(&ip->i_inode);
@@ -1034,14 +1032,14 @@ static bool gfs2_try_evict(struct gfs2_glock *gl)
10341032
spin_lock(&gl->gl_lockref.lock);
10351033
ip = gl->gl_object;
10361034
if (ip) {
1037-
inode_gl = ip->i_gl;
1038-
lockref_get(&inode_gl->gl_lockref);
10391035
clear_bit(GIF_DEFERRED_DELETE, &ip->i_flags);
1036+
if (!igrab(&ip->i_inode))
1037+
ip = NULL;
10401038
}
10411039
spin_unlock(&gl->gl_lockref.lock);
1042-
if (inode_gl) {
1043-
gfs2_glock_poke(inode_gl);
1044-
gfs2_glock_put(inode_gl);
1040+
if (ip) {
1041+
gfs2_glock_poke(ip->i_gl);
1042+
iput(&ip->i_inode);
10451043
}
10461044
evicted = !ip;
10471045
}

0 commit comments

Comments
 (0)