summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log.c
diff options
context:
space:
mode:
authorChristoph Hellwig2019-06-29 04:27:21 +0200
committerDarrick J. Wong2019-06-29 04:27:21 +0200
commit366fc4b898b3ca999b26d7c9fab92cb31ce4ad2b (patch)
tree42247cb29199110fcdad1f056e5169c385689d94 /fs/xfs/xfs_log.c
parentxfs: reformat xlog_get_lowest_lsn (diff)
downloadkernel-qcow2-linux-366fc4b898b3ca999b26d7c9fab92cb31ce4ad2b.tar.gz
kernel-qcow2-linux-366fc4b898b3ca999b26d7c9fab92cb31ce4ad2b.tar.xz
kernel-qcow2-linux-366fc4b898b3ca999b26d7c9fab92cb31ce4ad2b.zip
xfs: remove XLOG_STATE_IOABORT
This value is the only flag in ic_state, which we otherwise use as a state. Switch it to a new debug-only field and also report and actual error in the buffer in the I/O completion path. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_log.c')
-rw-r--r--fs/xfs/xfs_log.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 4bfacea9a357..49e7f645cbc1 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1257,16 +1257,16 @@ xlog_iodone(xfs_buf_t *bp)
struct xlog *l = iclog->ic_log;
int aborted = 0;
+#ifdef DEBUG
+ /* treat writes with injected CRC errors as failed */
+ if (iclog->ic_fail_crc)
+ bp->b_error = -EIO;
+#endif
+
/*
- * Race to shutdown the filesystem if we see an error or the iclog is in
- * IOABORT state. The IOABORT state is only set in DEBUG mode to inject
- * CRC errors into log recovery.
+ * Race to shutdown the filesystem if we see an error.
*/
- if (XFS_TEST_ERROR(bp->b_error, l->l_mp, XFS_ERRTAG_IODONE_IOERR) ||
- iclog->ic_state & XLOG_STATE_IOABORT) {
- if (iclog->ic_state & XLOG_STATE_IOABORT)
- iclog->ic_state &= ~XLOG_STATE_IOABORT;
-
+ if (XFS_TEST_ERROR(bp->b_error, l->l_mp, XFS_ERRTAG_IODONE_IOERR)) {
xfs_buf_ioerror_alert(bp, __func__);
xfs_buf_stale(bp);
xfs_force_shutdown(l->l_mp, SHUTDOWN_LOG_IO_ERROR);
@@ -1881,13 +1881,15 @@ xlog_sync(
* write on I/O completion and shutdown the fs. The subsequent mount
* detects the bad CRC and attempts to recover.
*/
+#ifdef DEBUG
if (XFS_TEST_ERROR(false, log->l_mp, XFS_ERRTAG_LOG_BAD_CRC)) {
iclog->ic_header.h_crc &= cpu_to_le32(0xAAAAAAAA);
- iclog->ic_state |= XLOG_STATE_IOABORT;
+ iclog->ic_fail_crc = true;
xfs_warn(log->l_mp,
"Intentionally corrupted log record at LSN 0x%llx. Shutdown imminent.",
be64_to_cpu(iclog->ic_header.h_lsn));
}
+#endif
bp->b_io_length = BTOBB(count);
bp->b_log_item = iclog;