cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] gfs2: Fix refcount leak in gfs2_glock_poke
@ 2020-08-03 11:52 Andreas Gruenbacher
  2020-08-03 12:17 ` Bob Peterson
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Gruenbacher @ 2020-08-03 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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 at vger.kernel.org # v5.8+
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/gfs2/glock.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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)
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Cluster-devel] [PATCH] gfs2: Fix refcount leak in gfs2_glock_poke
  2020-08-03 11:52 [Cluster-devel] [PATCH] gfs2: Fix refcount leak in gfs2_glock_poke Andreas Gruenbacher
@ 2020-08-03 12:17 ` Bob Peterson
  0 siblings, 0 replies; 2+ messages in thread
From: Bob Peterson @ 2020-08-03 12:17 UTC (permalink / raw)
  To: cluster-devel.redhat.com

----- Original Message -----
> 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 at vger.kernel.org # v5.8+
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
> ---
>  fs/gfs2/glock.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 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)
> --
> 2.26.2

Hi,

Looks okay.
I'd rather use nq_init and dq_uninit (and change similar code throughout
to use it more consistently) but in the past you've expressed a
concern that the compiler generates less efficient code.

Maybe it makes more sense to rework gfs2_glock_nq_init and dq_uninit
so the compiler does a more reasonable job? Or I suppose we could
delay that work for later.

Regards,

Bob Peterson



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-03 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-03 11:52 [Cluster-devel] [PATCH] gfs2: Fix refcount leak in gfs2_glock_poke Andreas Gruenbacher
2020-08-03 12:17 ` Bob Peterson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).