GFS2: Fix bmap allocation corner-case bug
authorSteven Whitehouse <swhiteho@redhat.com>
Fri, 12 Feb 2010 10:10:55 +0000 (10:10 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 2 Mar 2011 14:46:44 +0000 (09:46 -0500)
commit2d3a5662ff2d47e1d68a84f84bb78311d993f1d9
treecd35ceb81155c593ee141a86a9c6bc9cd6ade058
parent6934e92473f477a70ce50d83105a5ae346d1fb2c
GFS2: Fix bmap allocation corner-case bug

commit 07ccb7bf2c928fef4fea2cda69ba2e23479578db upstream.

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 <swhiteho@redhat.com>
Cc: maximilian attems <max@stro.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/gfs2/bmap.c