Commit 32d5b3dc authored by Darrick J. Wong's avatar Darrick J. Wong Committed by Long Li
Browse files

xfs: shut down filesystem if we xfs_trans_cancel with deferred work items

mainline inclusion
from mainline-v5.16-rc5
commit 47a6df7c
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I76JSK
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=47a6df7cd3174b91c6c862eae0b8d4e13591df52



--------------------------------

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: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarGuo Xuenan <guoxuenan@huawei.com>
Signed-off-by: default avatarLong Li <leo.lilong@huawei.com>
parent 2c33d690
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment