GFS2: Fall back to ignoring reservations, if there are no other blocks left
authorSteven Whitehouse <swhiteho@redhat.com>
Thu, 23 Aug 2012 12:43:40 +0000 (13:43 +0100)
committerSteven Whitehouse <swhiteho@redhat.com>
Mon, 24 Sep 2012 09:47:19 +0000 (10:47 +0100)
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>
fs/gfs2/rgrp.c

index 55a2651666c9b75a2ab58134974bb22df2ae5cb0..30c864e702982bc8c48ed56ce46ff1d9a8f4a137 100644 (file)
@@ -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,