]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: fix inode allocation block res calculation precedence
authorBrian Foster <bfoster@redhat.com>
Thu, 16 Jul 2020 01:44:50 +0000 (18:44 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 29 Jul 2020 03:24:14 +0000 (20:24 -0700)
commit4d7e34c22f10525d01cd814b4865028c7cb09f20
treeb9f31c69c3ebf96ef39af35f47afd4c3f79bf0fb
parent02e55c0d2426e2436919d3ffd94883da6c4fce11
xfs: fix inode allocation block res calculation precedence

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: 5c1f4173898b ("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>
fs/xfs/libxfs/xfs_trans_space.h