mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Fix ASSERT in zfs_receive_one()
This commit fixes the following ASSERT in zfs_receive_one() when
receiving a send stream from a root dataset with the "-e" option:
$ sudo zfs snap source@snap
$ sudo zfs send source@snap | sudo zfs recv -e destination/recv
chopprefix > drrb->drr_toname
ASSERT at libzfs_sendrecv.c:3804:zfs_receive_one()
Reviewed-by: Tom Caputi <tcaputi@datto.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #8121
This commit is contained in:
+16
-1
@@ -4240,10 +4240,21 @@ zfs_do_receive(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
if (flags.istail) {
|
||||
(void) fprintf(stderr, gettext("invalid option "
|
||||
"combination: -d and -e are mutually "
|
||||
"exclusive\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
flags.isprefix = B_TRUE;
|
||||
break;
|
||||
case 'e':
|
||||
flags.isprefix = B_TRUE;
|
||||
if (flags.isprefix) {
|
||||
(void) fprintf(stderr, gettext("invalid option "
|
||||
"combination: -d and -e are mutually "
|
||||
"exclusive\n"));
|
||||
usage(B_FALSE);
|
||||
}
|
||||
flags.istail = B_TRUE;
|
||||
break;
|
||||
case 'n':
|
||||
@@ -4279,6 +4290,10 @@ zfs_do_receive(int argc, char **argv)
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
/* zfs recv -e (use "tail" name) implies -d (remove dataset "head") */
|
||||
if (flags.istail)
|
||||
flags.isprefix = B_TRUE;
|
||||
|
||||
/* check number of arguments */
|
||||
if (argc < 1) {
|
||||
(void) fprintf(stderr, gettext("missing snapshot argument\n"));
|
||||
|
||||
Reference in New Issue
Block a user