aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2013-02-22 13:32:56 -0500
committerBen Myers <bpm@sgi.com>2013-03-18 13:30:38 -0500
commit83cdadd8b0559c93728d065d23ca3485fa567e54 (patch)
tree1d780da1a8a49c9eed1d390b92ece519f1fe9c3f /fs
parentLinux 3.9-rc1 (diff)
downloadlinux-dev-83cdadd8b0559c93728d065d23ca3485fa567e54.tar.xz
linux-dev-83cdadd8b0559c93728d065d23ca3485fa567e54.zip
xfs: fix potential infinite loop in xfs_iomap_prealloc_size()
If freesp == 0, we could end up in an infinite loop while squashing the preallocation. Break the loop when we've killed the prealloc entirely. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Ben Myers <bpm@sgi.com> (cherry picked from commit e78c420bfc2608bb5f9a0b9165b1071c1e31166a)
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_iomap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 912d83d8860a..b0b0f448e843 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -413,7 +413,7 @@ xfs_iomap_prealloc_size(
* have a large file on a small filesystem and the above
* lowspace thresholds are smaller than MAXEXTLEN.
*/
- while (alloc_blocks >= freesp)
+ while (alloc_blocks && alloc_blocks >= freesp)
alloc_blocks >>= 4;
}