Skip to content

Commit

Permalink
gfs2: Don't reject a supposedly full bitmap if we have blocks reserved
Browse files Browse the repository at this point in the history
Before this patch, you could get into situations like this:

1. Process 1 searches for X free blocks, finds them, makes a reservation
2. Process 2 searches for free blocks in the same rgrp, but now the
   bitmap is full because process 1's reservation is skipped over.
   So it marks the bitmap as GBF_FULL.
3. Process 1 tries to allocate blocks from its own reservation, but
   since the GBF_FULL bit is set, it skips over the rgrp and searches
   elsewhere, thus not using its own reservation.

This patch adds an additional check to allow processes to use their
own reservations.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
  • Loading branch information
Bob Peterson authored and Andreas Gruenbacher committed Jul 24, 2018
1 parent b7eba89 commit e79e0e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/gfs2/rgrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,8 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext,

while(1) {
bi = rbm_bi(rbm);
if (test_bit(GBF_FULL, &bi->bi_flags) &&
if ((ip == NULL || !gfs2_rs_active(&ip->i_res)) &&
test_bit(GBF_FULL, &bi->bi_flags) &&
(state == GFS2_BLKST_FREE))
goto next_bitmap;

Expand Down

0 comments on commit e79e0e1

Please sign in to comment.