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 <behlendorf1@llnl.gov> Signed-off-by: InsanePrawn <insane.prawny@gmail.com> Closes #11862
This commit is contained in:
parent
1f3de97374
commit
8b03fce289
|
@ -4586,26 +4586,6 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
|
||||||
(void) fflush(stdout);
|
(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
|
* If this is the top-level dataset, record it so we can use it
|
||||||
* for recursive operations later.
|
* 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);
|
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,
|
err = ioctl_err = lzc_receive_with_cmdprops(destsnap, rcvprops,
|
||||||
oxprops, wkeydata, wkeylen, origin, flags->force, flags->resumable,
|
oxprops, wkeydata, wkeylen, origin, flags->force, flags->resumable,
|
||||||
raw, infd, drr_noswap, -1, &read_bytes, &errflags,
|
raw, infd, drr_noswap, -1, &read_bytes, &errflags,
|
||||||
|
|
Loading…
Reference in New Issue