6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher agruenba@redhat.com
[ Upstream commit ffd1cf0443a208b80e40100ed02892d2ec74c7e9 ]
When a request to evict an inode comes in over the network, we are trying to grab an inode reference via the iopen glock's gl_object pointer. There is a very small probability that by the time such a request comes in, inode creation hasn't completed and the I_NEW flag is still set. To deal with that, wait for the inode and then check if inode creation was successful.
Signed-off-by: Andreas Gruenbacher agruenba@redhat.com Stable-dep-of: 2c63986dd35f ("gfs2: deallocate inodes in gfs2_create_inode") Signed-off-by: Sasha Levin sashal@kernel.org --- fs/gfs2/glock.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 9d72c5b8b7762..3c70c383b9bdd 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -984,6 +984,13 @@ static bool gfs2_try_evict(struct gfs2_glock *gl) if (ip && !igrab(&ip->i_inode)) ip = NULL; spin_unlock(&gl->gl_lockref.lock); + if (ip) { + wait_on_inode(&ip->i_inode); + if (is_bad_inode(&ip->i_inode)) { + iput(&ip->i_inode); + ip = NULL; + } + } if (ip) { set_bit(GIF_DEFER_DELETE, &ip->i_flags); d_prune_aliases(&ip->i_inode);