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. Signed-off-by: Bob Peterson <rpete...@redhat.com> --- fs/gfs2/trans.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c index 88209a81c7bb..f1ad6345d91f 100644 --- a/fs/gfs2/trans.c +++ b/fs/gfs2/trans.c @@ -272,6 +272,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) -- 2.23.0