Skip to content

Commit

Permalink
GFS2: Fix bmap allocation corner-case bug
Browse files Browse the repository at this point in the history
This patch solves a corner case during allocation which occurs if both
metadata (indirect) and data blocks are required but there is an
obstacle in the filesystem (e.g. a resource group header or another
allocated block) such that when the allocation is requested only
enough blocks for the metadata are returned.

By changing the exit condition of this loop, we ensure that a
minimum of one data block will always be returned.

Signed-off-by: Steven Whitehouse <[email protected]>
  • Loading branch information
swhiteho committed Feb 12, 2010
1 parent 0e5a9fb commit 07ccb7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/gfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock,
*ptr++ = cpu_to_be64(bn++);
break;
}
} while (state != ALLOC_DATA);
} while ((state != ALLOC_DATA) || !dblock);

ip->i_height = height;
gfs2_add_inode_blocks(&ip->i_inode, alloced);
Expand Down

0 comments on commit 07ccb7b

Please sign in to comment.