]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: standardize extent size hint validation
authorDarrick J. Wong <djwong@kernel.org>
Wed, 12 May 2021 19:49:19 +0000 (12:49 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 25 May 2021 01:01:04 +0000 (18:01 -0700)
commit5ba6a11dcc802d8785a47c08aab031f9c2b822bc
tree3053e6570e72b2b3593e50cb8f9cdc5d154b3ecf
parenta8407b0d82c58cac4f5a4ba90de31d3b6b8d7f72
xfs: standardize extent size hint validation

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>
fs/xfs/libxfs/xfs_inode_buf.c
fs/xfs/xfs_ioctl.c