]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: reserve enough blocks to handle btree splits when remapping
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 12 Apr 2017 19:26:07 +0000 (12:26 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 3 May 2017 20:21:40 +0000 (13:21 -0700)
commitf6ce6f37a436aff40a5f570f701a992ba96540e2
treea40dfe8284fd34d5cadca3bfee63fad922655946
parent4647c41cc44588f59de09b1b5840a1cdb362f6c5
xfs: reserve enough blocks to handle btree splits when remapping

In xfs_reflink_end_cow, we erroneously reserve only enough blocks to
handle adding 1 extent.  This is problematic if we fragment free space,
have to do CoW, and then have to perform multiple bmap btree expansions.
Furthermore, the BUI recovery routine doesn't reserve /any/ blocks to
handle btree splits, so log recovery fails after our first error causes
the filesystem to go down.

Therefore, refactor the transaction block reservation macros until we
have a macro that works for our deferred (re)mapping activities, and fix
both problems by using that macro.

With 1k blocks we can hit this fairly often in g/187 if the scratch fs
is big enough.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_trans_space.h
fs/xfs/xfs_bmap_item.c
fs/xfs/xfs_reflink.c