Skip to content

Commit ec23df2

Browse files
Andreas GruenbacherAstralBob
authored andcommitted
gfs2: Fix marking bitmaps non-full
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 <agruenba@redhat.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com> Reviewed-by: Steven Whitehouse <swhiteho@redhat.com>
1 parent 243fea4 commit ec23df2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

fs/gfs2/rgrp.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,10 @@ static void __rs_deltree(struct gfs2_blkreserv *rs)
641641
RB_CLEAR_NODE(&rs->rs_node);
642642

643643
if (rs->rs_free) {
644-
struct gfs2_bitmap *bi = rbm_bi(&rs->rs_rbm);
644+
u64 last_block = gfs2_rbm_to_block(&rs->rs_rbm) +
645+
rs->rs_free - 1;
646+
struct gfs2_rbm last_rbm = { .rgd = rs->rs_rbm.rgd, };
647+
struct gfs2_bitmap *start, *last;
645648

646649
/* return reserved blocks to the rgrp */
647650
BUG_ON(rs->rs_rbm.rgd->rd_reserved < rs->rs_free);
@@ -652,7 +655,13 @@ static void __rs_deltree(struct gfs2_blkreserv *rs)
652655
it will force the number to be recalculated later. */
653656
rgd->rd_extfail_pt += rs->rs_free;
654657
rs->rs_free = 0;
655-
clear_bit(GBF_FULL, &bi->bi_flags);
658+
if (gfs2_rbm_from_block(&last_rbm, last_block))
659+
return;
660+
start = rbm_bi(&rs->rs_rbm);
661+
last = rbm_bi(&last_rbm);
662+
do
663+
clear_bit(GBF_FULL, &start->bi_flags);
664+
while (start++ != last);
656665
}
657666
}
658667

0 commit comments

Comments
 (0)