forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
=> openzfs#2668: turbo/issue-2666 - Allow for "zfs receive" to skip e…
…xisting snapshots by adding the option "-s" to zfs receive. Signed-off-by: Turbo Fredriksson <[email protected]> Closes: openzfs#2666
- Loading branch information
Showing
4 changed files
with
37 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2825,7 +2825,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, | |
* away (and have therefore specified -F and removed any | ||
* snapshots). | ||
*/ | ||
if (stream_wantsnewfs) { | ||
if (stream_wantsnewfs && !flags->skip) { | ||
if (!flags->force) { | ||
zcmd_free_nvlists(&zc); | ||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, | ||
|
@@ -2913,6 +2913,17 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, | |
zc.zc_begin_record = drr_noswap->drr_u.drr_begin; | ||
zc.zc_cookie = infd; | ||
zc.zc_guid = flags->force; | ||
|
||
if (zfs_dataset_exists(hdl, zc.zc_value, ZFS_TYPE_SNAPSHOT) && | ||
flags->skip) { | ||
(void) printf("skipping snapshot %s - %s already exists\n", | ||
drrb->drr_toname, zc.zc_value); | ||
(void) fflush(stdout); | ||
|
||
zcmd_free_nvlists(&zc); | ||
return (recv_skip(hdl, infd, flags->byteswap)); | ||
} | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
FransUrbo
via email
Author
Owner
|
||
if (flags->verbose) { | ||
(void) printf("%s %s stream of %s into %s\n", | ||
flags->dryrun ? "would receive" : "receiving", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Isn't this case already handled slightly farther down at line 2983. Existing snapshots should be skipped.