Skip to content

Commit

Permalink
GFS2: Fall back to ignoring reservations, if there are no other block…
Browse files Browse the repository at this point in the history
…s left

When we get to the stage of allocating blocks, we know that the
resource group in question must contain enough free blocks, otherwise
gfs2_inplace_reserve() would have failed. So if we are left with only
free blocks which are reserved, then we must use those. This can happen
if another node has sneeked in and use some blocks reserved on this
node, for example. Generally this will happen very rarely and only
when the resouce group is nearly full.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
  • Loading branch information
Steven Whitehouse committed Sep 24, 2012
1 parent 2b9731e commit 137834a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/gfs2/rgrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2012,6 +2012,11 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
gfs2_rbm_from_block(&rbm, goal);
error = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, ip, false);

if (error == -ENOSPC) {
gfs2_rbm_from_block(&rbm, goal);
error = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, NULL, false);
}

/* Since all blocks are reserved in advance, this shouldn't happen */
if (error) {
fs_warn(sdp, "error=%d, nblocks=%u, full=%d\n", error, *nblocks,
Expand Down

0 comments on commit 137834a

Please sign in to comment.