summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2020-07-27 19:18:57 +0200
committerAndreas Gruenbacher <agruenba@redhat.com>2020-08-03 13:45:37 +0200
commitc07bfb4d8fa1ee11c6d18b093d0bb6c8832d3626 (patch)
tree2a15ed75ca0f4b009a65f9572ee053db321b8344
parent4c5c3010408d872359134cfa209619778d8f15e6 (diff)
downloadlinux-c07bfb4d8fa1ee11c6d18b093d0bb6c8832d3626.tar.gz
gfs2: Fix refcount leak in gfs2_glock_poke
In gfs2_glock_poke, make sure gfs2_holder_uninit is called on the local
glock holder.  Without that, we're leaking a glock and a pid reference.

Fixes: 9e8990dea926 ("gfs2: Smarter iopen glock waiting")
Cc: stable@vger.kernel.org # v5.8+
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
-rw-r--r--fs/gfs2/glock.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 57134d326cfa..f13b136654ca 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -790,9 +790,11 @@ static void gfs2_glock_poke(struct gfs2_glock *gl)
 	struct gfs2_holder gh;
 	int error;
 
-	error = gfs2_glock_nq_init(gl, LM_ST_SHARED, flags, &gh);
+	gfs2_holder_init(gl, LM_ST_SHARED, flags, &gh);
+	error = gfs2_glock_nq(&gh);
 	if (!error)
 		gfs2_glock_dq(&gh);
+	gfs2_holder_uninit(&gh);
 }
 
 static bool gfs2_try_evict(struct gfs2_glock *gl)