]> granicus.if.org Git - zfs/commitdiff
Don't call arc_buf_destroy on unallocated arc_buf
authorchrisrd <chris@onthe.net.au>
Wed, 23 Oct 2019 22:26:17 +0000 (09:26 +1100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 23 Oct 2019 22:26:17 +0000 (15:26 -0700)
Fixes an obvious issue of calling arc_buf_destroy() on an
unallocated arc_buf.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matt Ahrens <matt@delphix.com>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Chris Dunlop <chris@onthe.net.au>
Closes #9453

module/zfs/dmu_send.c

index ea28dbc2821022f2e9c257add20cc2b6d613dd56..b0a56650e5707ac2d6a838781e7efa4d86792073 100644 (file)
@@ -924,6 +924,7 @@ do_dump(dmu_send_cookie_t *dscp, struct send_range *range)
                blkptr_t *bp = &srdp->bp;
                spa_t *spa =
                    dmu_objset_spa(dscp->dsc_os);
+               arc_buf_t *abuf = NULL;
 
                ASSERT3U(srdp->datablksz, ==, BP_GET_LSIZE(bp));
                ASSERT3U(range->start_blkid + 1, ==, range->end_blkid);
@@ -936,7 +937,6 @@ do_dump(dmu_send_cookie_t *dscp, struct send_range *range)
                                zioflags |= ZIO_FLAG_RAW;
                        }
 
-                       arc_buf_t *abuf;
                        zbookmark_phys_t zb;
                        ASSERT3U(range->start_blkid, ==, DMU_SPILL_BLKID);
                        zb.zb_objset = dmu_objset_id(dscp->dsc_os);
@@ -949,8 +949,10 @@ do_dump(dmu_send_cookie_t *dscp, struct send_range *range)
                            zioflags, &aflags, &zb) != 0)
                                return (SET_ERROR(EIO));
 
-                       err = dump_spill(dscp, bp, zb.zb_object, abuf->b_data);
-                       arc_buf_destroy(abuf, &abuf);
+                       err = dump_spill(dscp, bp, zb.zb_object,
+                           (abuf == NULL ? NULL : abuf->b_data));
+                       if (abuf != NULL)
+                               arc_buf_destroy(abuf, &abuf);
                        return (err);
                }
                if (send_do_embed(dscp, bp)) {
@@ -965,7 +967,6 @@ do_dump(dmu_send_cookie_t *dscp, struct send_range *range)
                    dscp->dsc_resume_offset));
                /* it's a level-0 block of a regular object */
                arc_flags_t aflags = ARC_FLAG_WAIT;
-               arc_buf_t *abuf = NULL;
                uint64_t offset;
 
                /*