mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 03:37:45 +03:00
Fix 'zfs remap <poolname@snapname>'
Only filesystems and volumes are valid 'zfs remap' parameters: when passed a snapshot name zfs_remap_indirects() does not handle the EINVAL returned from libzfs_core, which results in failing an assertion and consequently crashing. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov> Signed-off-by: loli10K <ezomori.nozomu@gmail.com> Closes #7454
This commit is contained in:
@@ -7108,11 +7108,29 @@ zfs_do_diff(int argc, char **argv)
|
||||
return (err != 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* zfs remap <filesystem | volume>
|
||||
*
|
||||
* Remap the indirect blocks in the given fileystem or volume.
|
||||
*/
|
||||
static int
|
||||
zfs_do_remap(int argc, char **argv)
|
||||
{
|
||||
const char *fsname;
|
||||
int err = 0;
|
||||
int c;
|
||||
|
||||
/* check options */
|
||||
while ((c = getopt(argc, argv, "")) != -1) {
|
||||
switch (c) {
|
||||
case '?':
|
||||
(void) fprintf(stderr,
|
||||
gettext("invalid option '%c'\n"), optopt);
|
||||
usage(B_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc != 2) {
|
||||
(void) fprintf(stderr, gettext("wrong number of arguments\n"));
|
||||
usage(B_FALSE);
|
||||
|
||||
Reference in New Issue
Block a user