]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: shut down filesystem if we xfs_trans_cancel with deferred work items
authorDarrick J. Wong <djwong@kernel.org>
Wed, 15 Dec 2021 19:53:14 +0000 (11:53 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 21 Dec 2021 17:49:41 +0000 (09:49 -0800)
commit9d117cbec183255eb7060d90edaaf7a3d3500085
tree34e4224ffdecfa452d3bd5e700e31d9de353fae4
parentf4faf532b51b095af557f2b8dce62f42101c8b01
xfs: 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: Dave Chinner <dchinner@redhat.com>
fs/xfs/xfs_trans.c