xfs: finish dfops on every insert range shift iteration
authorBrian Foster <bfoster@redhat.com>
Tue, 18 Aug 2020 15:05:58 +0000 (08:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Sep 2020 17:14:17 +0000 (19:14 +0200)
commit91565765b6de29982b4d44c092eca2ea2a123385
tree605d54abb3d69271da3c7cc5c515dc9645ba58fc
parent81fbc28873ef481780a4a55cb01f006b24cba0d4
xfs: finish dfops on every insert range shift iteration

[ Upstream commit 9c516e0e4554e8f26ab73d46cbc789d7d8db664d ]

The recent change to make insert range an atomic operation used the
incorrect transaction rolling mechanism. The explicit transaction
roll does not finish deferred operations. This means that intents
for rmapbt updates caused by extent shifts are not logged until the
final transaction commits. Thus if a crash occurs during an insert
range, log recovery might leave the rmapbt in an inconsistent state.
This was discovered by repeated runs of generic/455.

Update insert range to finish dfops on every shift iteration. This
is similar to collapse range and ensures that intents are logged
with the transactions that make associated changes.

Fixes: dd87f87d87fa ("xfs: rework insert range into an atomic operation")
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/xfs/xfs_bmap_util.c