On 05/10/18 20:18, Andreas Gruenbacher wrote:
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.
This looks like a bug fix that we should have anyway,

Steve.

Signed-off-by: Andreas Gruenbacher <agrue...@redhat.com>
---
  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);
        }
  }

Reply via email to