]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: standardize extent size hint validation
authorDarrick J. Wong <djwong@kernel.org>
Wed, 30 Jun 2021 22:38:58 +0000 (18:38 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 30 Jun 2021 22:38:58 +0000 (18:38 -0400)
commitef39c7c7dc77ae7d1a9bcbe8692fa24cfdd689f2
tree1d6d27c78b116996708b4fa7f8ec1bf05ddd1a44
parent57cd98fd0a3091f0c77ae8429c775589a369c637
xfs: standardize extent size hint validation

Source kernel commit: 6b69e485894b355b333bd286f0f0958e41d8754a

While chasing a bug involving invalid extent size hints being propagated
into newly created realtime files, I noticed that the xfs_ioctl_setattr
checks for the extent size hints weren't the same as the ones now
encoded in libxfs and used for validation in repair and mkfs.

Because the checks in libxfs are more stringent than the ones in the
ioctl, it's possible for a live system to set inode flags that
immediately result in corruption warnings.  Specifically, it's possible
to set an extent size hint on an rtinherit directory without checking if
the hint is aligned to the realtime extent size, which makes no sense
since that combination is used only to seed new realtime files.

Replace the open-coded and inadequate checks with the libxfs verifier
versions and update the code comments a bit.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_inode_buf.c