aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2010-08-23 06:49:34 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2010-09-20 06:18:59 -0400
commit9a3f236d40a99ea8dca3df40d8ef67631057cad6 (patch)
tree9249794a803c7df5bcef90038199351f14f09b1d /fs/gfs2
parent820969f353587281d645735c83c7f07d606e67ba (diff)
GFS2: Add a bug trap in allocation code
This adds a check to ensure that if we reach the block allocator that we don't try and proceed if there is no alloc structure hanging off the inode. This should only happen if there is a bug in GFS2. The error return code is distinctive in order that it will be easily spotted. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/rgrp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 370c29b536ea..66b6d4d8b1d2 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1496,11 +1496,19 @@ int gfs2_alloc_block(struct gfs2_inode *ip, u64 *bn, unsigned int *n)
1496 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 1496 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1497 struct buffer_head *dibh; 1497 struct buffer_head *dibh;
1498 struct gfs2_alloc *al = ip->i_alloc; 1498 struct gfs2_alloc *al = ip->i_alloc;
1499 struct gfs2_rgrpd *rgd = al->al_rgd; 1499 struct gfs2_rgrpd *rgd;
1500 u32 goal, blk; 1500 u32 goal, blk;
1501 u64 block; 1501 u64 block;
1502 int error; 1502 int error;
1503 1503
1504 /* Only happens if there is a bug in gfs2, return something distinctive
1505 * to ensure that it is noticed.
1506 */
1507 if (al == NULL)
1508 return -ECANCELED;
1509
1510 rgd = al->al_rgd;
1511
1504 if (rgrp_contains_block(rgd, ip->i_goal)) 1512 if (rgrp_contains_block(rgd, ip->i_goal))
1505 goal = ip->i_goal - rgd->rd_data0; 1513 goal = ip->i_goal - rgd->rd_data0;
1506 else 1514 else