xfs: force the log offline when log intent item recovery fails
authorDarrick J. Wong <djwong@kernel.org>
Fri, 18 Jun 2021 18:57:07 +0000 (11:57 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 21 Jun 2021 17:14:24 +0000 (10:14 -0700)
commit4e6b8270c820c8c57a73f869799a0af2b56eff3e
tree317c8f9d624125d695496b0b9e0b5538f417cdb1
parent81ed94751b1513fcc5978dcc06eb1f5b4e55a785
xfs: force the log offline when log intent item recovery fails

If any part of log intent item recovery fails, we should shut down the
log immediately to stop the log from writing a clean unmount record to
disk, because the metadata is not consistent.  The inability to cancel a
dirty transaction catches most of these cases, but there are a few
things that have slipped through the cracks, such as ENOSPC from a
transaction allocation, or runtime errors that result in cancellation of
a non-dirty transaction.

This solves some weird behaviors reported by customers where a system
goes down, the first mount fails, the second succeeds, but then the fs
goes down later because of inconsistent metadata.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_log.c
fs/xfs/xfs_log_recover.c