Re: [Cluster-devel] [PATCH v2 2/6] gfs2: Clean up gfs2_adjust_reservation

2018-12-04 Thread Andreas Gruenbacher
On Sat, 1 Dec 2018 at 12:10, Andreas Gruenbacher  wrote:
> Unconditionally call gfs2_adjust_reservation in gfs2_alloc_blocks.  Move
> the code for updating rd_free and rd_free_clone from gfs2_alloc_blocks
> into gfs2_adjust_reservation.

Let me change that description to:

Prepare gfs2_adjust_reservation for resource group glock sharing: Call
it from gfs2_alloc_blocks unconditionally.  Update rd_free and
rd_free_clone in gfs2_adjust_reservation under rd_rsspin: holding the
resource group glock alone will no longer be enough to keep the balance
of the resoruce group counters straight.

Thanks,
Andreas



Re: [Cluster-devel] [PATCH] gfs2: Fix loop in gfs2_rbm_find

2018-12-04 Thread Andreas Gruenbacher
On Tue, 4 Dec 2018 at 21:22, Andreas Gruenbacher  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



[Cluster-devel] [PATCH] gfs2: Fix loop in gfs2_rbm_find

2018-12-04 Thread Andreas Gruenbacher
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: sta...@vger.kernel.org # v3.13+
Signed-off-by: Andreas Gruenbacher 
Signed-off-by: Bob Peterson 
---
 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