diff options
author | Matthew Ahrens <[email protected]> | 2023-05-08 11:20:23 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2023-05-08 11:20:23 -0700 |
commit | 3095ca91c261756c509d0afb4422027753e68c90 (patch) | |
tree | cd0c97824d0c8b7f40d9cfad54684832214a910c /cmd/fsck.zfs.in | |
parent | dd19821149cb7e3785249eb9be75dd9864c88d56 (diff) |
Verify block pointers before writing them out
If a block pointer is corrupted (but the block containing it checksums
correctly, e.g. due to a bug that overwrites random memory), we can
often detect it before the block is read, with the `zfs_blkptr_verify()`
function, which is used in `arc_read()`, `zio_free()`, etc.
However, such corruption is not typically recoverable. To recover from
it we would need to detect the memory error before the block pointer is
written to disk.
This PR verifies BP's that are contained in indirect blocks and dnodes
before they are written to disk, in `dbuf_write_ready()`. This way,
we'll get a panic before the on-disk data is corrupted. This will help
us to diagnose what's causing the corruption, as well as being much
easier to recover from.
To minimize performance impact, only checks that can be done without
holding the spa_config_lock are performed.
Additionally, when corruption is detected, the raw words of the block
pointer are logged. (Note that `dprintf_bp()` is a no-op by default,
but if enabled it is not safe to use with invalid block pointers.)
Reviewed-by: Rich Ercolani <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Paul Zuchowski <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Matthew Ahrens <[email protected]>
Closes #14817
Diffstat (limited to 'cmd/fsck.zfs.in')
0 files changed, 0 insertions, 0 deletions