]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
mkfs.xfs: don't increase agblocks past maximum
authorEric Sandeen <sandeen@redhat.com>
Mon, 19 Sep 2011 21:45:06 +0000 (21:45 +0000)
committerAlex Elder <aelder@sgi.com>
Wed, 21 Sep 2011 18:50:33 +0000 (13:50 -0500)
commit7c8b1f6adcbee85fd82a605d8dd980de2c0386f9
tree8945fb0790854136390d3192d1ed8b0796814d0a
parentf815670b5d230e3b312c935ea7b669ba36d5641c
mkfs.xfs: don't increase agblocks past maximum

RH QA discovered this bug:

Steps to Reproduce:
1. Create 4 TB - 1 B partition
    dd if=/dev/zero of=x.img bs=1 count=0 seek=4398046511103
2. Create xfs fs with 512 B block size on the partition
    mkfs.xfs -b size=512 xfs.img

Actual results:
Agsize is computed incorrectly resulting in fs creation fail:
agsize (2147483648b) too big, maximum is 2147483647 blocks

This is due to the "rounding up" at the very end of the calculations;
there may be other places to alleviate the problem, but it seems
most obvious to simply skip the rounding up if it would create too
many blocks in the AG.  Worst case, we lose 1 block per AG.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
mkfs/xfs_mkfs.c