gfs2: fix glock reference problem in gfs2_trans_add_unrevoke
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 gfs2: fix glock reference problem in gfs2_trans_add_unrevoke
Hi,
Patch 9287c6452d2 fixed a situation in which gfs2 could use a glock after it had been freed. To fix that, it temporarily added a new glock reference by calling gfs2_glock_hold in function gfs2_add_revoke. However, if the bd element was removed by gfs2_trans_add_unrevoke it failed to drop the additional reference.
This patch adds logic to gfs2_trans_add_unrevoke so that it can properly drop the additional glock reference.
Fixes 9287c6452d2b1f24ea8e84bd3cf6f3c6f267f712
Signed-off-by Bob Peterson <[email protected]>
Cc stable at vger.kernel.org # v5.2+
--- fs/gfs2/trans.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/gfs2/trans.c +5 -0
@@ -262,6 +262,11 @@ void gfs2_trans_remove_revoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len)list_del_init (&bd->bd_list);gfs2_assert_withdraw (sdp, sdp->sd_log_num_revoke); sdp->sd_log_num_revoke--; +if (bd->bd_gl && +atomic_dec_return (&bd->bd_gl->gl_revokes) ==0 ) { +clear_bit (GLF_LFLUSH , &bd->bd_gl->gl_flags); +gfs2_glock_queue_put (bd->bd_gl); + }kmem_cache_free (gfs2_bufdata_cachep, bd); tr->tr_num_revoke--;if (--n ==0 )