]> granicus.if.org Git - zfs/commitdiff
OpenZFS 7230 - add assertions to dmu_send_impl() to verify that stream includes BEGIN...
authorkernelOfTruth aka. kOT, Gentoo user <kerneloftruth@gmail.com>
Thu, 22 Sep 2016 23:01:19 +0000 (01:01 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 22 Sep 2016 23:01:19 +0000 (16:01 -0700)
Authored by: Matt Krantz <matt.krantz@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Approved by: Robert Mustacchi <rm@joyent.com>
Ported-by: kernelOfTruth <kerneloftruth@gmail.com>
OpenZFS-issue: https://www.illumos.org/issues/7230
OpenZFS-commit: https://github.com/illumos/illumos-gate/commit/12b90ee2
Closes #5112

include/sys/dmu_impl.h
module/zfs/dmu_send.c

index 3e4423c8d6a0be3d16eafc3eb11129efd08ca532..ae129b7cfa7f4458eaea08dc0f0b3d258634ff85 100644 (file)
@@ -273,6 +273,8 @@ typedef struct dmu_sendarg {
        uint64_t dsa_last_data_offset;
        uint64_t dsa_resume_object;
        uint64_t dsa_resume_offset;
+       boolean_t dsa_sent_begin;
+       boolean_t dsa_sent_end;
 } dmu_sendarg_t;
 
 void dmu_object_zapify(objset_t *, uint64_t, dmu_object_type_t, dmu_tx_t *);
index ebe103045cca6383150f4f1049553a16ddc3baae..5e95da52d639479e9e05f7110357f5f83aa545c3 100644 (file)
@@ -169,11 +169,16 @@ dump_record(dmu_sendarg_t *dsp, void *payload, int payload_len)
        fletcher_4_incremental_native(dsp->dsa_drr,
            offsetof(dmu_replay_record_t, drr_u.drr_checksum.drr_checksum),
            &dsp->dsa_zc);
-       if (dsp->dsa_drr->drr_type != DRR_BEGIN) {
+       if (dsp->dsa_drr->drr_type == DRR_BEGIN) {
+               dsp->dsa_sent_begin = B_TRUE;
+       } else {
                ASSERT(ZIO_CHECKSUM_IS_ZERO(&dsp->dsa_drr->drr_u.
                    drr_checksum.drr_checksum));
                dsp->dsa_drr->drr_u.drr_checksum.drr_checksum = dsp->dsa_zc;
        }
+       if (dsp->dsa_drr->drr_type == DRR_END) {
+               dsp->dsa_sent_end = B_TRUE;
+       }
        fletcher_4_incremental_native(&dsp->dsa_drr->
            drr_u.drr_checksum.drr_checksum,
            sizeof (zio_cksum_t), &dsp->dsa_zc);
@@ -979,6 +984,8 @@ out:
        list_remove(&to_ds->ds_sendstreams, dsp);
        mutex_exit(&to_ds->ds_sendstream_lock);
 
+       VERIFY(err != 0 || (dsp->dsa_sent_begin && dsp->dsa_sent_end));
+
        kmem_free(drr, sizeof (dmu_replay_record_t));
        kmem_free(dsp, sizeof (dmu_sendarg_t));