* [PATCH] gfs2: Put bitmap buffers in put_super
@ 2018-11-19 16:22 Andreas Gruenbacher
2018-11-23 19:18 ` Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Gruenbacher @ 2018-11-19 16:22 UTC (permalink / raw)
To: stable
commit 10283ea525d30f2e99828978fd04d8427876a7ad upstream.
gfs2_put_super calls gfs2_clear_rgrpd to destroy the gfs2_rgrpd objects
attached to the resource group glocks. That function should release the
buffers attached to the gfs2_bitmap objects (bi_bh), but the call to
gfs2_rgrp_brelse for doing that is missing.
When gfs2_releasepage later runs across these buffers which are still
referenced, it refuses to free them. This causes the pages the buffers
are attached to to remain referenced as well. With enough mount/unmount
cycles, the system will eventually run out of memory.
Fix this by adding the missing call to gfs2_rgrp_brelse in
gfs2_clear_rgrpd.
(Also fix a gfs2_rgrp_relse -> gfs2_rgrp_brelse typo in a comment.)
Fixes: 39b0f1e92908 ("GFS2: Don't brelse rgrp buffer_heads every allocation")
Cc: stable@vger.kernel.org # v4.9
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
fs/gfs2/rgrp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 832824994aae..073126707270 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -715,6 +715,7 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
spin_lock(&gl->gl_lockref.lock);
gl->gl_object = NULL;
spin_unlock(&gl->gl_lockref.lock);
+ gfs2_rgrp_brelse(rgd);
gfs2_glock_add_to_lru(gl);
gfs2_glock_put(gl);
}
@@ -1125,7 +1126,7 @@ static u32 count_unlinked(struct gfs2_rgrpd *rgd)
* @rgd: the struct gfs2_rgrpd describing the RG to read in
*
* Read in all of a Resource Group's header and bitmap blocks.
- * Caller must eventually call gfs2_rgrp_relse() to free the bitmaps.
+ * Caller must eventually call gfs2_rgrp_brelse() to free the bitmaps.
*
* Returns: errno
*/
--
2.19.1.546.g028f9c799.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] gfs2: Put bitmap buffers in put_super
@ 2018-11-19 16:24 Andreas Gruenbacher
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Gruenbacher @ 2018-11-19 16:24 UTC (permalink / raw)
To: stable
commit 10283ea525d30f2e99828978fd04d8427876a7ad upstream.
gfs2_put_super calls gfs2_clear_rgrpd to destroy the gfs2_rgrpd objects
attached to the resource group glocks. That function should release the
buffers attached to the gfs2_bitmap objects (bi_bh), but the call to
gfs2_rgrp_brelse for doing that is missing.
When gfs2_releasepage later runs across these buffers which are still
referenced, it refuses to free them. This causes the pages the buffers
are attached to to remain referenced as well. With enough mount/unmount
cycles, the system will eventually run out of memory.
Fix this by adding the missing call to gfs2_rgrp_brelse in
gfs2_clear_rgrpd.
(Also fix a gfs2_rgrp_relse -> gfs2_rgrp_brelse typo in a comment.)
Fixes: 39b0f1e92908 ("GFS2: Don't brelse rgrp buffer_heads every allocation")
Cc: stable@vger.kernel.org # v4.4
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
fs/gfs2/rgrp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 832824994aae..073126707270 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -715,6 +715,7 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp)
spin_lock(&gl->gl_lockref.lock);
gl->gl_object = NULL;
spin_unlock(&gl->gl_lockref.lock);
+ gfs2_rgrp_brelse(rgd);
gfs2_glock_add_to_lru(gl);
gfs2_glock_put(gl);
}
@@ -1125,7 +1126,7 @@ static u32 count_unlinked(struct gfs2_rgrpd *rgd)
* @rgd: the struct gfs2_rgrpd describing the RG to read in
*
* Read in all of a Resource Group's header and bitmap blocks.
- * Caller must eventually call gfs2_rgrp_relse() to free the bitmaps.
+ * Caller must eventually call gfs2_rgrp_brelse() to free the bitmaps.
*
* Returns: errno
*/
--
2.19.1.546.g028f9c799.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gfs2: Put bitmap buffers in put_super
2018-11-19 16:22 [PATCH] gfs2: Put bitmap buffers in put_super Andreas Gruenbacher
@ 2018-11-23 19:18 ` Sasha Levin
0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2018-11-23 19:18 UTC (permalink / raw)
To: Andreas Gruenbacher; +Cc: stable
On Mon, Nov 19, 2018 at 05:22:32PM +0100, Andreas Gruenbacher wrote:
>commit 10283ea525d30f2e99828978fd04d8427876a7ad upstream.
>
>gfs2_put_super calls gfs2_clear_rgrpd to destroy the gfs2_rgrpd objects
>attached to the resource group glocks. That function should release the
>buffers attached to the gfs2_bitmap objects (bi_bh), but the call to
>gfs2_rgrp_brelse for doing that is missing.
>
>When gfs2_releasepage later runs across these buffers which are still
>referenced, it refuses to free them. This causes the pages the buffers
>are attached to to remain referenced as well. With enough mount/unmount
>cycles, the system will eventually run out of memory.
>
>Fix this by adding the missing call to gfs2_rgrp_brelse in
>gfs2_clear_rgrpd.
>
>(Also fix a gfs2_rgrp_relse -> gfs2_rgrp_brelse typo in a comment.)
>
>Fixes: 39b0f1e92908 ("GFS2: Don't brelse rgrp buffer_heads every allocation")
>Cc: stable@vger.kernel.org # v4.9
>Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
I've queued both patches to their appropriate branches, thank you.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-24 6:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-19 16:22 [PATCH] gfs2: Put bitmap buffers in put_super Andreas Gruenbacher
2018-11-23 19:18 ` Sasha Levin
-- strict thread matches above, loose matches on Subject: below --
2018-11-19 16:24 Andreas Gruenbacher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox