Skip to content

Commit

Permalink
xfs: fix potential infinite loop in xfs_iomap_prealloc_size()
Browse files Browse the repository at this point in the history
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 e78c420)
  • Loading branch information
Brian Foster authored and Ben Myers committed Mar 18, 2013
1 parent 6dbe51c commit 83cdadd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/xfs/xfs_iomap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 83cdadd

Please sign in to comment.