Skip to content

Commit 8f15de1

Browse files
committed
Verify every block pointer is either embedded, hole, or has a valid DVA
Now instead of crashing when attempting to read the corrupt block pointer, ZFS will return ECKSUM, in a stack that looks like this: ``` none:set-error zfs.ko`arc_read+0x1d82 zfs.ko`dbuf_read+0xa8c zfs.ko`dmu_buf_hold_array_by_dnode+0x292 zfs.ko`dmu_read_uio_dnode+0x47 zfs.ko`zfs_read+0x2d5 zfs.ko`zfs_freebsd_read+0x7b kernel`VOP_READ_APV+0xd0 kernel`vn_read+0x20e kernel`vn_io_fault_doio+0x45 kernel`vn_io_fault1+0x15e kernel`vn_io_fault+0x150 kernel`dofileread+0x80 kernel`sys_read+0xb7 kernel`amd64_syscall+0x424 kernel`0xffffffff810633cb ``` This patch should hopefully also prevent such corrupt block pointers from being written to disk in the first place. Fixes #17077 Sponsored by: ConnectWise Signed-off-by: Alan Somers <[email protected]>
1 parent f7b3232 commit 8f15de1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

module/zfs/zio.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,12 @@ zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp,
12131213
}
12141214
return (errors == 0);
12151215
}
1216+
if (unlikely(!BP_IS_EMBEDDED(bp) && !BP_IS_HOLE(bp) &&
1217+
BP_GET_NDVAS(bp) <= 0))
1218+
{
1219+
errors += zfs_blkptr_verify_log(spa, bp, blk_verify,
1220+
"blkptr at %px has no valid DVAs", bp);
1221+
}
12161222
if (unlikely(BP_GET_CHECKSUM(bp) >= ZIO_CHECKSUM_FUNCTIONS)) {
12171223
errors += zfs_blkptr_verify_log(spa, bp, blk_verify,
12181224
"blkptr at %px has invalid CHECKSUM %llu",

0 commit comments

Comments
 (0)