Skip to content

Commit

Permalink
Fix zdb_read_block using zio after it is destroyed.
Browse files Browse the repository at this point in the history
The checksum display code of zdb_read_block uses a zio
to read in the block and then calls zio_checksum_compute.
Use a new zio in the call to zio_checksum_compute not the zio
from the read which has been destroyed by zio_wait.

Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Fixes openzfs#9644
  • Loading branch information
PaulZ-98 committed Dec 2, 2019
1 parent 42a826e commit ff5e97c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/zdb/zdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -6608,7 +6608,11 @@ zdb_read_block(char *thing, spa_t *spa)
}
error = zio_wait(czio);
if (error == 0 || error == ECKSUM) {
zio_checksum_compute(czio, ck, pabd, lsize);
zio_t ck_zio = { 0 };
ck_zio.io_offset = DVA_GET_OFFSET(&bp->blk_dva[0]);
ck_zio.io_bp = bp;
ck_zio.io_spa = spa;
zio_checksum_compute(&ck_zio, ck, pabd, lsize);
printf("%12s\tcksum=%llx:%llx:%llx:%llx\n",
zio_checksum_table[ck].ci_name,
(u_longlong_t)bp->blk_cksum.zc_word[0],
Expand Down

0 comments on commit ff5e97c

Please sign in to comment.