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: [email protected] # v5.2+ --- fs/gfs2/trans.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c index 35e3059255fe..0eb3c5198c2b 100644 --- a/fs/gfs2/trans.c +++ b/fs/gfs2/trans.c @@ -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)
