diff options
author | Christoph Hellwig <hch@lst.de> | 2019-06-28 22:27:21 -0400 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2019-06-28 22:27:21 -0400 |
commit | 366fc4b898b3ca999b26d7c9fab92cb31ce4ad2b (patch) | |
tree | 42247cb29199110fcdad1f056e5169c385689d94 /fs/xfs | |
parent | 9bff313253ebfbf93537988ce0937a337c9fcf42 (diff) |
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')
-rw-r--r-- | fs/xfs/xfs_log.c | 20 | ||||
-rw-r--r-- | fs/xfs/xfs_log_priv.h | 4 |
2 files changed, 14 insertions, 10 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) | |||
1257 | struct xlog *l = iclog->ic_log; | 1257 | struct xlog *l = iclog->ic_log; |
1258 | int aborted = 0; | 1258 | int aborted = 0; |
1259 | 1259 | ||
1260 | #ifdef DEBUG | ||
1261 | /* treat writes with injected CRC errors as failed */ | ||
1262 | if (iclog->ic_fail_crc) | ||
1263 | bp->b_error = -EIO; | ||
1264 | #endif | ||
1265 | |||
1260 | /* | 1266 | /* |
1261 | * Race to shutdown the filesystem if we see an error or the iclog is in | 1267 | * Race to shutdown the filesystem if we see an error. |
1262 | * IOABORT state. The IOABORT state is only set in DEBUG mode to inject | ||
1263 | * CRC errors into log recovery. | ||
1264 | */ | 1268 | */ |
1265 | if (XFS_TEST_ERROR(bp->b_error, l->l_mp, XFS_ERRTAG_IODONE_IOERR) || | 1269 | if (XFS_TEST_ERROR(bp->b_error, l->l_mp, XFS_ERRTAG_IODONE_IOERR)) { |
1266 | iclog->ic_state & XLOG_STATE_IOABORT) { | ||
1267 | if (iclog->ic_state & XLOG_STATE_IOABORT) | ||
1268 | iclog->ic_state &= ~XLOG_STATE_IOABORT; | ||
1269 | |||
1270 | xfs_buf_ioerror_alert(bp, __func__); | 1270 | xfs_buf_ioerror_alert(bp, __func__); |
1271 | xfs_buf_stale(bp); | 1271 | xfs_buf_stale(bp); |
1272 | xfs_force_shutdown(l->l_mp, SHUTDOWN_LOG_IO_ERROR); | 1272 | xfs_force_shutdown(l->l_mp, SHUTDOWN_LOG_IO_ERROR); |
@@ -1881,13 +1881,15 @@ xlog_sync( | |||
1881 | * write on I/O completion and shutdown the fs. The subsequent mount | 1881 | * write on I/O completion and shutdown the fs. The subsequent mount |
1882 | * detects the bad CRC and attempts to recover. | 1882 | * detects the bad CRC and attempts to recover. |
1883 | */ | 1883 | */ |
1884 | #ifdef DEBUG | ||
1884 | if (XFS_TEST_ERROR(false, log->l_mp, XFS_ERRTAG_LOG_BAD_CRC)) { | 1885 | if (XFS_TEST_ERROR(false, log->l_mp, XFS_ERRTAG_LOG_BAD_CRC)) { |
1885 | iclog->ic_header.h_crc &= cpu_to_le32(0xAAAAAAAA); | 1886 | iclog->ic_header.h_crc &= cpu_to_le32(0xAAAAAAAA); |
1886 | iclog->ic_state |= XLOG_STATE_IOABORT; | 1887 | iclog->ic_fail_crc = true; |
1887 | xfs_warn(log->l_mp, | 1888 | xfs_warn(log->l_mp, |
1888 | "Intentionally corrupted log record at LSN 0x%llx. Shutdown imminent.", | 1889 | "Intentionally corrupted log record at LSN 0x%llx. Shutdown imminent.", |
1889 | be64_to_cpu(iclog->ic_header.h_lsn)); | 1890 | be64_to_cpu(iclog->ic_header.h_lsn)); |
1890 | } | 1891 | } |
1892 | #endif | ||
1891 | 1893 | ||
1892 | bp->b_io_length = BTOBB(count); | 1894 | bp->b_io_length = BTOBB(count); |
1893 | bp->b_log_item = iclog; | 1895 | bp->b_log_item = iclog; |
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h index 78a2abeba895..ac4bca257609 100644 --- a/fs/xfs/xfs_log_priv.h +++ b/fs/xfs/xfs_log_priv.h | |||
@@ -50,7 +50,6 @@ static inline uint xlog_get_client_id(__be32 i) | |||
50 | #define XLOG_STATE_CALLBACK 0x0020 /* Callback functions now */ | 50 | #define XLOG_STATE_CALLBACK 0x0020 /* Callback functions now */ |
51 | #define XLOG_STATE_DIRTY 0x0040 /* Dirty IC log, not ready for ACTIVE status*/ | 51 | #define XLOG_STATE_DIRTY 0x0040 /* Dirty IC log, not ready for ACTIVE status*/ |
52 | #define XLOG_STATE_IOERROR 0x0080 /* IO error happened in sync'ing log */ | 52 | #define XLOG_STATE_IOERROR 0x0080 /* IO error happened in sync'ing log */ |
53 | #define XLOG_STATE_IOABORT 0x0100 /* force abort on I/O completion (debug) */ | ||
54 | #define XLOG_STATE_ALL 0x7FFF /* All possible valid flags */ | 53 | #define XLOG_STATE_ALL 0x7FFF /* All possible valid flags */ |
55 | #define XLOG_STATE_NOTUSED 0x8000 /* This IC log not being used */ | 54 | #define XLOG_STATE_NOTUSED 0x8000 /* This IC log not being used */ |
56 | 55 | ||
@@ -223,6 +222,9 @@ typedef struct xlog_in_core { | |||
223 | atomic_t ic_refcnt ____cacheline_aligned_in_smp; | 222 | atomic_t ic_refcnt ____cacheline_aligned_in_smp; |
224 | xlog_in_core_2_t *ic_data; | 223 | xlog_in_core_2_t *ic_data; |
225 | #define ic_header ic_data->hic_header | 224 | #define ic_header ic_data->hic_header |
225 | #ifdef DEBUG | ||
226 | bool ic_fail_crc : 1; | ||
227 | #endif | ||
226 | } xlog_in_core_t; | 228 | } xlog_in_core_t; |
227 | 229 | ||
228 | /* | 230 | /* |