Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83cdadd8 authored by Brian Foster's avatar Brian Foster Committed by Ben Myers
Browse files

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: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>

(cherry picked from commit e78c420b)
parent 6dbe51c2
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -413,7 +413,7 @@ xfs_iomap_prealloc_size(
		 * have a large file on a small filesystem and the above
		 * have a large file on a small filesystem and the above
		 * lowspace thresholds are smaller than MAXEXTLEN.
		 * lowspace thresholds are smaller than MAXEXTLEN.
		 */
		 */
		while (alloc_blocks >= freesp)
		while (alloc_blocks && alloc_blocks >= freesp)
			alloc_blocks >>= 4;
			alloc_blocks >>= 4;
	}
	}