]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
libxfs: shut down filesystem if we xfs_trans_cancel with deferred work items
authorDarrick J. Wong <djwong@kernel.org>
Fri, 25 Feb 2022 22:32:48 +0000 (17:32 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 25 Feb 2022 22:32:48 +0000 (17:32 -0500)
commitf98b7a261130726c33accd295ec0d2a22f270cde
tree27a4e18ad89c14566a2465054d004d224900538c
parent3aef6357ea94a1b699ea48fbc2d54879ca820307
libxfs: shut down filesystem if we xfs_trans_cancel with deferred work items

While debugging some very strange rmap corruption reports in connection
with the online directory repair code.  I root-caused the error to the
following incorrect sequence:

<start repair transaction>
<expand directory, causing a deferred rmap to be queued>
<roll transaction>
<cancel transaction>

Obviously, we should have committed the transaction instead of
cancelling it.  Thinking more broadly, however, xfs_trans_cancel should
have warned us that we were throwing away work item that we already
committed to performing.  This is not correct, and we need to shut down
the filesystem.

Change xfs_trans_cancel to complain in the loudest manner if we're
cancelling any transaction with deferred work items attached.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/trans.c