Skip to content

Commit 19fe2e0

Browse files
committed
Tighten the DVA validity check, as requested by @amotin
Every non-embedded, non-hole BP should have at least one valid DVA, and it must be the first one. Signed-off-by: Alan Somers <[email protected]>
1 parent 00fb087 commit 19fe2e0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

module/zfs/zio.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,9 +1212,10 @@ zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp,
12121212
bp, (longlong_t)BPE_GET_PSIZE(bp));
12131213
}
12141214
return (errors == 0);
1215-
}
1216-
if (unlikely(!BP_IS_EMBEDDED(bp) && !BP_IS_HOLE(bp) &&
1217-
BP_GET_NDVAS(bp) <= 0)) {
1215+
} else if (BP_IS_HOLE(bp)) {
1216+
/* Holes are allowed (expected, even) to have no DVAs */
1217+
} else if (unlikely(!DVA_IS_VALID(&bp->blk_dva[0]))) {
1218+
/* Non-hole, non-embedded BPs _must_ have at least one DVA */
12181219
errors += zfs_blkptr_verify_log(spa, bp, blk_verify,
12191220
"blkptr at %px has no valid DVAs", bp);
12201221
}

0 commit comments

Comments
 (0)