diff --git a/module/zfs/ddt.c b/module/zfs/ddt.c index ef868619ab63..2d8763a54954 100644 --- a/module/zfs/ddt.c +++ b/module/zfs/ddt.c @@ -323,8 +323,10 @@ ddt_phys_addref(ddt_phys_t *ddp) void ddt_phys_decref(ddt_phys_t *ddp) { - ASSERT((int64_t)ddp->ddp_refcnt > 0); - ddp->ddp_refcnt--; + if (ddp) { + ASSERT((int64_t)ddp->ddp_refcnt > 0); + ddp->ddp_refcnt--; + } } void diff --git a/module/zfs/zio.c b/module/zfs/zio.c index 77b1764d7403..0622553f5f23 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -2249,8 +2249,11 @@ zio_ddt_free(zio_t *zio) ddt_enter(ddt); freedde = dde = ddt_lookup(ddt, bp, B_TRUE); - ddp = ddt_phys_select(dde, bp); - ddt_phys_decref(ddp); + if (dde) { + ddp = ddt_phys_select(dde, bp); + if (ddp) + ddt_phys_decref(ddp); + } ddt_exit(ddt); return (ZIO_PIPELINE_CONTINUE);