All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gfs2: Fix loop in gfs2_rbm_find
@ 2018-12-04 20:22 ` Andreas Gruenbacher
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Gruenbacher @ 2018-12-04 20:22 UTC (permalink / raw)
  To: cluster-devel; +Cc: Andreas Gruenbacher, stable, Bob Peterson

In gfs2_rbm_find, fix the resource group wrap-around logic that commit
e579ed4f44 broke.  Without this fix, gfs2_rbm_find can end up in an
infinite loop in the worst case.

Fixes: e579ed4f44 ("GFS2: Introduce rbm field bii")
Cc: stable@vger.kernel.org # v3.13+
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
 fs/gfs2/rgrp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index b08a530433adf..8d79165703621 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1780,9 +1780,9 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,
 			goto next_iter;
 		}
 		if (ret == -E2BIG) {
+			n += rbm->bii - initial_bii;
 			rbm->bii = 0;
 			rbm->offset = 0;
-			n += (rbm->bii - initial_bii);
 			goto res_covered_end_of_rgrp;
 		}
 		return ret;
-- 
2.19.1.546.g028f9c799.dirty

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

* [Cluster-devel] [PATCH] gfs2: Fix loop in gfs2_rbm_find
@ 2018-12-04 20:22 ` Andreas Gruenbacher
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Gruenbacher @ 2018-12-04 20:22 UTC (permalink / raw)
  To: cluster-devel.redhat.com

In gfs2_rbm_find, fix the resource group wrap-around logic that commit
e579ed4f44 broke.  Without this fix, gfs2_rbm_find can end up in an
infinite loop in the worst case.

Fixes: e579ed4f44 ("GFS2: Introduce rbm field bii")
Cc: stable at vger.kernel.org # v3.13+
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
 fs/gfs2/rgrp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index b08a530433adf..8d79165703621 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1780,9 +1780,9 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,
 			goto next_iter;
 		}
 		if (ret == -E2BIG) {
+			n += rbm->bii - initial_bii;
 			rbm->bii = 0;
 			rbm->offset = 0;
-			n += (rbm->bii - initial_bii);
 			goto res_covered_end_of_rgrp;
 		}
 		return ret;
-- 
2.19.1.546.g028f9c799.dirty



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

* [Cluster-devel] [PATCH] gfs2: Fix loop in gfs2_rbm_find
  2018-12-04 20:22 ` [Cluster-devel] " Andreas Gruenbacher
  (?)
@ 2018-12-04 21:14 ` Andreas Gruenbacher
  -1 siblings, 0 replies; 3+ messages in thread
From: Andreas Gruenbacher @ 2018-12-04 21:14 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Tue, 4 Dec 2018 at 21:22, Andreas Gruenbacher <agruenba@redhat.com> wrote:
>
> In gfs2_rbm_find, fix the resource group wrap-around logic that commit
> e579ed4f44 broke.  Without this fix, gfs2_rbm_find can end up in an
> infinite loop in the worst case.

After some more review, it seems that the current mechanism of
exclusive resource group locking and the combination of how
gfs2_inplace_reserve and gfs2_alloc_blocks invoke gfs2_rbm_find
prevents an infinite loop in gfs2_rbm_find. This fix still prevents
unnecessary bitmap scanning though.

Andreas



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

end of thread, other threads:[~2018-12-04 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-04 20:22 [PATCH] gfs2: Fix loop in gfs2_rbm_find Andreas Gruenbacher
2018-12-04 20:22 ` [Cluster-devel] " Andreas Gruenbacher
2018-12-04 21:14 ` Andreas Gruenbacher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.