]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: Directory's data fork extent counter can never overflow
authorChandan Babu R <chandan.babu@oracle.com>
Wed, 22 Jun 2022 19:28:52 +0000 (14:28 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 22 Jun 2022 19:28:52 +0000 (14:28 -0500)
commitf0683d63dd0803f20236ee0661d46f049d8d09d9
tree05243b0b1525002ce06f2d5d44f7e0824ce657f7
parentd8873a58386c55db5713cb0a855ad5b4d193e238
xfs: Directory's data fork extent counter can never overflow

Source kernel commit: 83a21c18441f75aec64548692b52d34582b98a6a

The maximum file size that can be represented by the data fork extent counter
in the worst case occurs when all extents are 1 block in length and each block
is 1KB in size.

With XFS_MAX_EXTCNT_DATA_FORK_SMALL representing maximum extent count and with
1KB sized blocks, a file can reach upto,
(2^31) * 1KB = 2TB

This is much larger than the theoretical maximum size of a directory
i.e. XFS_DIR2_SPACE_SIZE * 3 = ~96GB.

Since a directory's inode can never overflow its data fork extent counter,
this commit removes all the overflow checks associated with
it. xfs_dinode_verify() now performs a rough check to verify if a diretory's
data fork is larger than 96GB.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_bmap.c
libxfs/xfs_da_btree.h
libxfs/xfs_da_format.h
libxfs/xfs_dir2.c
libxfs/xfs_format.h
libxfs/xfs_inode_buf.c
libxfs/xfs_inode_fork.h