summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorPaul Zuchowski <[email protected]>2019-02-15 15:41:38 -0500
committerBrian Behlendorf <[email protected]>2019-02-15 12:41:38 -0800
commit9c5e88b1ded19cb4b19b9d767d5c71b34c189540 (patch)
tree08a51e07bb19bae06bdfbc61ae36b140514870ae /cmd
parente73ab1b38cd099f3416eed0ab5576639383bbdcc (diff)
zfs should optionally send holds
Add -h switch to zfs send command to send dataset holds. If holds are present in the stream, zfs receive will create them on the target dataset, unless the zfs receive -h option is used to skip receive of holds. Reviewed-by: Alek Pinchuk <[email protected]> Reviewed-by: loli10K <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Signed-off-by: Paul Zuchowski <[email protected]> Closes #7513
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zfs/zfs_main.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index ab2b99b02..2017c9803 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -278,10 +278,10 @@ get_usage(zfs_help_t idx)
case HELP_PROMOTE:
return (gettext("\tpromote <clone-filesystem>\n"));
case HELP_RECEIVE:
- return (gettext("\treceive [-vnsFu] "
+ return (gettext("\treceive [-vnsFhu] "
"[-o <property>=<value>] ... [-x <property>] ...\n"
"\t <filesystem|volume|snapshot>\n"
- "\treceive [-vnsFu] [-o <property>=<value>] ... "
+ "\treceive [-vnsFhu] [-o <property>=<value>] ... "
"[-x <property>] ... \n"
"\t [-d | -e] <filesystem>\n"
"\treceive -A <filesystem|volume>\n"));
@@ -293,7 +293,7 @@ get_usage(zfs_help_t idx)
case HELP_ROLLBACK:
return (gettext("\trollback [-rRf] <snapshot>\n"));
case HELP_SEND:
- return (gettext("\tsend [-DnPpRvLecwb] [-[i|I] snapshot] "
+ return (gettext("\tsend [-DnPpRvLecwhb] [-[i|I] snapshot] "
"<snapshot>\n"
"\tsend [-nvPLecw] [-i snapshot|bookmark] "
"<filesystem|volume|snapshot>\n"
@@ -3981,11 +3981,12 @@ zfs_do_send(int argc, char **argv)
{"compressed", no_argument, NULL, 'c'},
{"raw", no_argument, NULL, 'w'},
{"backup", no_argument, NULL, 'b'},
+ {"holds", no_argument, NULL, 'h'},
{0, 0, 0, 0}
};
/* check options */
- while ((c = getopt_long(argc, argv, ":i:I:RDpvnPLet:cwb", long_options,
+ while ((c = getopt_long(argc, argv, ":i:I:RDpvnPLeht:cwb", long_options,
NULL)) != -1) {
switch (c) {
case 'i':
@@ -4008,6 +4009,9 @@ zfs_do_send(int argc, char **argv)
case 'b':
flags.backup = B_TRUE;
break;
+ case 'h':
+ flags.holds = B_TRUE;
+ break;
case 'P':
flags.parsable = B_TRUE;
flags.verbose = B_TRUE;
@@ -4130,7 +4134,7 @@ zfs_do_send(int argc, char **argv)
char frombuf[ZFS_MAX_DATASET_NAME_LEN];
if (flags.replicate || flags.doall || flags.props ||
- flags.backup || flags.dedup ||
+ flags.backup || flags.dedup || flags.holds ||
(strchr(argv[0], '@') == NULL &&
(flags.dryrun || flags.verbose || flags.progress))) {
(void) fprintf(stderr, gettext("Error: "
@@ -4235,7 +4239,7 @@ zfs_do_receive(int argc, char **argv)
nomem();
/* check options */
- while ((c = getopt(argc, argv, ":o:x:denuvFsA")) != -1) {
+ while ((c = getopt(argc, argv, ":o:x:dehnuvFsA")) != -1) {
switch (c) {
case 'o':
if (!parseprop(props, optarg)) {
@@ -4267,6 +4271,9 @@ zfs_do_receive(int argc, char **argv)
}
flags.istail = B_TRUE;
break;
+ case 'h':
+ flags.skipholds = B_TRUE;
+ break;
case 'n':
flags.dryrun = B_TRUE;
break;