aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPrawn <[email protected]>2021-04-12 18:35:55 +0200
committerGitHub <[email protected]>2021-04-12 09:35:55 -0700
commitee6615e07a8bb68d81d23e06421f4b0235b7f2a7 (patch)
treea9864134246feea1a7045a54275209f2dc515ae4 /lib
parent722b7f9a4c8f1051e624c88160d9ff7e2fbdf6bb (diff)
cmd/zfs receive: allow dry-run (-n) to check property args
zfs recv -n does not report some errors it could. The code to bail out of the receive if in dry-run mode came a little early, skipping validation of cmdprops (recv -x and -o) among others. Move the check down to enable these additional checks. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: InsanePrawn <[email protected]> Closes #11862
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs/libzfs_sendrecv.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c
index 347657552..7db7cf74f 100644
--- a/lib/libzfs/libzfs_sendrecv.c
+++ b/lib/libzfs/libzfs_sendrecv.c
@@ -4586,26 +4586,6 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
(void) fflush(stdout);
}
- if (flags->dryrun) {
- void *buf = zfs_alloc(hdl, SPA_MAXBLOCKSIZE);
-
- /*
- * We have read the DRR_BEGIN record, but we have
- * not yet read the payload. For non-dryrun sends
- * this will be done by the kernel, so we must
- * emulate that here, before attempting to read
- * more records.
- */
- err = recv_read(hdl, infd, buf, drr->drr_payloadlen,
- flags->byteswap, NULL);
- free(buf);
- if (err != 0)
- goto out;
-
- err = recv_skip(hdl, infd, flags->byteswap);
- goto out;
- }
-
/*
* If this is the top-level dataset, record it so we can use it
* for recursive operations later.
@@ -4650,6 +4630,26 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
zfs_prop_to_name(ZFS_PROP_ENCRYPTION), ZIO_CRYPT_OFF);
}
+ if (flags->dryrun) {
+ void *buf = zfs_alloc(hdl, SPA_MAXBLOCKSIZE);
+
+ /*
+ * We have read the DRR_BEGIN record, but we have
+ * not yet read the payload. For non-dryrun sends
+ * this will be done by the kernel, so we must
+ * emulate that here, before attempting to read
+ * more records.
+ */
+ err = recv_read(hdl, infd, buf, drr->drr_payloadlen,
+ flags->byteswap, NULL);
+ free(buf);
+ if (err != 0)
+ goto out;
+
+ err = recv_skip(hdl, infd, flags->byteswap);
+ goto out;
+ }
+
err = ioctl_err = lzc_receive_with_cmdprops(destsnap, rcvprops,
oxprops, wkeydata, wkeylen, origin, flags->force, flags->resumable,
raw, infd, drr_noswap, -1, &read_bytes, &errflags,