]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
mkfs: validate rt extent size hint when rtinherit is set
authorDarrick J. Wong <djwong@kernel.org>
Wed, 28 Jul 2021 23:03:16 +0000 (19:03 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 28 Jul 2021 23:03:16 +0000 (19:03 -0400)
commit1e8afffb6260104a8a3773f6fdb91af8ca1a6ff4
treeb8a555ad046b29280412625dce478833492cd668
parent5f0624275bcc7d29a9bce7488e2626f91a099ac0
mkfs: validate rt extent size hint when rtinherit is set

Extent size hints exist to nudge the behavior of the file data block
allocator towards trying to make aligned allocations.  Therefore, it
doesn't make sense to allow a hint that isn't a multiple of the
fundamental allocation unit for a given file.

This means that if the sysadmin is formatting with rtinherit set on the
root dir, validate_extsize_hint needs to check the hint value on a
simulated realtime file to make sure that it's correct.  Unfortunately,
the gate check here was for a nonzero rt extent size, which is wrong
since we never format with rtextsize==0.  This leads to absurd failures
such as:

# mkfs.xfs -f /dev/sdf -r extsize=7b -d rtinherit=0,extszinherit=13
illegal extent size hint 13, must be less than 649088 and a multiple of 7.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
mkfs/xfs_mkfs.c