GFS2: Stop block extents at the end of bitmaps
authorBob Peterson <rpeterso@redhat.com>
Tue, 28 Aug 2012 12:45:56 +0000 (08:45 -0400)
committerSteven Whitehouse <swhiteho@redhat.com>
Mon, 24 Sep 2012 09:47:23 +0000 (10:47 +0100)
This patch stops multiple block allocations if a nonzero
return code is received from gfs2_rbm_from_block. Without
this patch, if enough pressure is put on the file system,
you get a kernel warning quickly followed by:
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<ffffffffa04f47e8>] gfs2_alloc_blocks+0x2c8/0x880 [gfs2]
With this patch, things run normally.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/rgrp.c

index 886954126704d74e54cc8e31cb3796b706fd6bb0..defb8265ce5234f8344534fc9582b6e6a05a6d8a 100644 (file)
@@ -1834,8 +1834,7 @@ static void gfs2_alloc_extent(const struct gfs2_rbm *rbm, bool dinode,
        block++;
        while (*n < elen) {
                ret = gfs2_rbm_from_block(&pos, block);
-               WARN_ON(ret);
-               if (gfs2_testbit(&pos) != GFS2_BLKST_FREE)
+               if (ret || gfs2_testbit(&pos) != GFS2_BLKST_FREE)
                        break;
                gfs2_trans_add_bh(pos.rgd->rd_gl, pos.bi->bi_bh, 1);
                gfs2_setbit(&pos, true, GFS2_BLKST_USED);