aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2014-08-03 22:42:40 -0400
committerDave Chinner <david@fromorbit.com>2014-08-03 22:42:40 -0400
commit400b9d88757c0bfbdfa97014e090ec40a31c1282 (patch)
tree0d1885f0a324e6132be0c996566696c024488855 /fs/xfs
parent5ef828c4152726f56751c78ea844f08d2b2a4fa3 (diff)
xfs: catch buffers written without verifiers attached
We recently had a bug where buffers were slipping through log recovery without any verifier attached to them. This was resulting in on-disk CRC mismatches for valid data. Add some warning code to catch this occurrence so that we catch such bugs during development rather than not being aware they exist. Note that we cannot do this verification unconditionally as non-CRC filesystems don't always attach verifiers to the buffers being written. e.g. during log recovery we cannot identify all the different types of buffers correctly on non-CRC filesystems, so we can't attach the correct verifiers in all cases and so we don't attach any. Hence we don't want on non-CRC filesystems to avoid spamming the logs with false indications. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_buf.c14
-rw-r--r--fs/xfs/xfs_log.c8
2 files changed, 21 insertions, 1 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index a6dc83e70ece..cd7b8ca9b064 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1330,6 +1330,20 @@ _xfs_buf_ioapply(
1330 SHUTDOWN_CORRUPT_INCORE); 1330 SHUTDOWN_CORRUPT_INCORE);
1331 return; 1331 return;
1332 } 1332 }
1333 } else if (bp->b_bn != XFS_BUF_DADDR_NULL) {
1334 struct xfs_mount *mp = bp->b_target->bt_mount;
1335
1336 /*
1337 * non-crc filesystems don't attach verifiers during
1338 * log recovery, so don't warn for such filesystems.
1339 */
1340 if (xfs_sb_version_hascrc(&mp->m_sb)) {
1341 xfs_warn(mp,
1342 "%s: no ops on block 0x%llx/0x%x",
1343 __func__, bp->b_bn, bp->b_length);
1344 xfs_hex_dump(bp->b_addr, 64);
1345 dump_stack();
1346 }
1333 } 1347 }
1334 } else if (bp->b_flags & XBF_READ_AHEAD) { 1348 } else if (bp->b_flags & XBF_READ_AHEAD) {
1335 rw = READA; 1349 rw = READA;
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 7647818b8c8a..d015ed7d4a26 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1369,8 +1369,14 @@ xlog_alloc_log(
1369 1369
1370 xlog_get_iclog_buffer_size(mp, log); 1370 xlog_get_iclog_buffer_size(mp, log);
1371 1371
1372 /*
1373 * Use a NULL block for the extra log buffer used during splits so that
1374 * it will trigger errors if we ever try to do IO on it without first
1375 * having set it up properly.
1376 */
1372 error = -ENOMEM; 1377 error = -ENOMEM;
1373 bp = xfs_buf_alloc(mp->m_logdev_targp, 0, BTOBB(log->l_iclog_size), 0); 1378 bp = xfs_buf_alloc(mp->m_logdev_targp, XFS_BUF_DADDR_NULL,
1379 BTOBB(log->l_iclog_size), 0);
1374 if (!bp) 1380 if (!bp)
1375 goto out_free_log; 1381 goto out_free_log;
1376 1382