]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: fix inode allocation block res calculation precedence
authorBrian Foster <bfoster@redhat.com>
Fri, 4 Sep 2020 20:01:20 +0000 (16:01 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 4 Sep 2020 20:01:20 +0000 (16:01 -0400)
commit625c12fba2d613c209108c5e4f07af8309bcbafb
tree8e0dcb316c31b1d0e8746ae4af016da563a3d548
parent10c0a390aa7c54bbdf556d8db4c6fc6b1ada19b4
xfs: fix inode allocation block res calculation precedence

Source kernel commit: b2a8864728683443f34a9fd33a2b78b860934cc1

The block reservation calculation for inode allocation is supposed
to consist of the blocks required for the inode chunk plus
(maxlevels-1) of the inode btree multiplied by the number of inode
btrees in the fs (2 when finobt is enabled, 1 otherwise).

Instead, the macro returns (ialloc_blocks + 2) due to a precedence
error in the calculation logic. This leads to block reservation
overruns via generic/531 on small block filesystems with finobt
enabled. Add braces to fix the calculation and reserve the
appropriate number of blocks.

Fixes: 9d43b180af67 ("xfs: update inode allocation/free transaction reservations for finobt")
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_trans_space.h