From: Andreas Gruenbacher Date: Fri, 5 Oct 2018 21:18:50 +0200 Subject: [Cluster-devel] [PATCH 07/11] gfs2: Fix marking bitmaps non-full In-Reply-To: <20181005191854.2566-1-agruenba@redhat.com> References: <20181005191854.2566-1-agruenba@redhat.com> Message-ID: <20181005191854.2566-8-agruenba@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reservations in gfs can span multiple gfs2_bitmaps (but they won't span multiple resource groups). When removing a reservation, we want to clear the GBF_FULL flags of all involved gfs2_bitmaps, not just that of the first bitmap. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/rgrp.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index ee6ea7d8cf44..ee981085db33 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c @@ -672,7 +672,7 @@ static void __rs_deltree(struct gfs2_blkreserv *rs) RB_CLEAR_NODE(&rs->rs_node); if (rs->rs_free) { - struct gfs2_bitmap *bi; + struct gfs2_bitmap *start, *last; /* return reserved blocks to the rgrp */ BUG_ON(rs->rs_rgd->rd_reserved < rs->rs_free); @@ -682,10 +682,15 @@ static void __rs_deltree(struct gfs2_blkreserv *rs) contiguous with a span of free blocks that follows. Still, it will force the number to be recalculated later. */ rgd->rd_extfail_pt += rs->rs_free; + start = gfs2_block_to_bitmap(rgd, rs->rs_start); + last = gfs2_block_to_bitmap(rgd, + rs->rs_start + rs->rs_free - 1); rs->rs_free = 0; - bi = gfs2_block_to_bitmap(rgd, rs->rs_start); - if (bi) - clear_bit(GBF_FULL, &bi->bi_flags); + if (!start || !last) + return; + do + clear_bit(GBF_FULL, &start->bi_flags); + while (start++ != last); } } -- 2.17.1