From c9e3595d148ae9f6450d3d47d004e58a28db633e Mon Sep 17 00:00:00 2001 From: mav Date: Wed, 11 May 2016 11:32:38 +0000 Subject: [PATCH] MFC r297509: MFV r297506: 6738 zfs send stream padding needs documentation Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Reviewed by: Paul Dagnelie Reviewed by: Dan McDonald Approved by: Robert Mustacchi Author: Eli Rosenthal illumos/illumos-gate@c20404ff77119516354b0d112d28b7ea0dadd303 git-svn-id: svn://svn.freebsd.org/base/stable/10@299432 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- .../opensolaris/uts/common/fs/zfs/dmu_send.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c index 188810b89..9e8d86eac 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c @@ -107,6 +107,19 @@ dump_bytes(dmu_sendarg_t *dsp, void *buf, int len) dsl_dataset_t *ds = dmu_objset_ds(dsp->dsa_os); struct uio auio; struct iovec aiov; + + /* + * The code does not rely on this (len being a multiple of 8). We keep + * this assertion because of the corresponding assertion in + * receive_read(). Keeping this assertion ensures that we do not + * inadvertently break backwards compatibility (causing the assertion + * in receive_read() to trigger on old software). + * + * Removing the assertions could be rolled into a new feature that uses + * data that isn't 8-byte aligned; if the assertions were removed, a + * feature flag would have to be added. + */ + ASSERT0(len % 8); aiov.iov_base = buf; @@ -1824,7 +1837,10 @@ receive_read(struct receive_arg *ra, int len, void *buf) { int done = 0; - /* some things will require 8-byte alignment, so everything must */ + /* + * The code doesn't rely on this (lengths being multiples of 8). See + * comment in dump_bytes. + */ ASSERT0(len % 8); while (done < len) { -- 2.45.0