diff options
author | Paul Zuchowski <[email protected]> | 2019-12-03 17:37:15 -0500 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-12-03 14:37:15 -0800 |
commit | 5a089773742b0c48a7baea32194566ac2987be7d (patch) | |
tree | bd8bcce9edd5c905a8eb8f9cc1fed6f68f5ceb03 /cmd/zdb/zdb.c | |
parent | 54c8366e3984b710dc2ce99ffdce6dfb15e8eecf (diff) |
Fix zdb_read_block using zio after it is destroyed
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.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Igor Kozhukhov <[email protected]>
Signed-off-by: Paul Zuchowski <[email protected]>
Closes #9644
Closes #9657
Diffstat (limited to 'cmd/zdb/zdb.c')
-rw-r--r-- | cmd/zdb/zdb.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index 2d35bd0f9..3cdd7f2c1 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -6608,13 +6608,18 @@ 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 = zio_root(spa, NULL, NULL, 0); + ck_zio->io_offset = + DVA_GET_OFFSET(&bp->blk_dva[0]); + ck_zio->io_bp = bp; + 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], (u_longlong_t)bp->blk_cksum.zc_word[1], (u_longlong_t)bp->blk_cksum.zc_word[2], (u_longlong_t)bp->blk_cksum.zc_word[3]); + zio_wait(ck_zio); } else { printf("error %d reading block\n", error); } |