diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2010-08-23 11:49:34 +0100 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2010-09-20 11:18:59 +0100 |
commit | 9a3f236d40a99ea8dca3df40d8ef67631057cad6 (patch) | |
tree | 9249794a803c7df5bcef90038199351f14f09b1d /fs/gfs2/rgrp.c | |
parent | 820969f353587281d645735c83c7f07d606e67ba (diff) | |
download | linux-stable-9a3f236d40a99ea8dca3df40d8ef67631057cad6.tar.gz linux-stable-9a3f236d40a99ea8dca3df40d8ef67631057cad6.tar.bz2 linux-stable-9a3f236d40a99ea8dca3df40d8ef67631057cad6.zip |
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/rgrp.c')
-rw-r--r-- | fs/gfs2/rgrp.c | 10 |
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) struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); struct buffer_head *dibh; struct gfs2_alloc *al = ip->i_alloc; - struct gfs2_rgrpd *rgd = al->al_rgd; + struct gfs2_rgrpd *rgd; u32 goal, blk; u64 block; int error; + /* Only happens if there is a bug in gfs2, return something distinctive + * to ensure that it is noticed. + */ + if (al == NULL) + return -ECANCELED; + + rgd = al->al_rgd; + if (rgrp_contains_block(rgd, ip->i_goal)) goal = ip->i_goal - rgd->rd_data0; else |