aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorkernelOfTruth aka. kOT, Gentoo user <[email protected]>2016-09-23 01:01:19 +0200
committerBrian Behlendorf <[email protected]>2016-09-22 16:01:19 -0700
commit51907a31bc20a6697ec9a92a58c163a0c0df5de7 (patch)
tree03df2a68ffe1d4bf42301082d07da9306e1ccfbb /module
parent5df39c1e43e8d903ef4317e505cf85e64ef7e172 (diff)
OpenZFS 7230 - add assertions to dmu_send_impl() to verify that stream includes BEGIN and END records
Authored by: Matt Krantz <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Reviewed by: Igor Kozhukhov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Approved by: Robert Mustacchi <[email protected]> Ported-by: kernelOfTruth <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7230 OpenZFS-commit: https://github.com/illumos/illumos-gate/commit/12b90ee2 Closes #5112
Diffstat (limited to 'module')
-rw-r--r--module/zfs/dmu_send.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c
index ebe103045..5e95da52d 100644
--- a/module/zfs/dmu_send.c
+++ b/module/zfs/dmu_send.c
@@ -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));