diff options
author | Alexander Motin <mav@FreeBSD.org> | 2018-08-02 19:09:13 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2018-08-02 19:09:13 +0000 |
commit | cf8fc527c9dc27e9e99a28c0c621bed2a74bc203 (patch) | |
tree | 843a7761976c2c4efc2a6f6a27264263f029d3f4 /lib | |
parent | 2395a7f52dc8a224e322d6d10ce1fd59c6d971c9 (diff) | |
download | src-cf8fc527c9dc27e9e99a28c0c621bed2a74bc203.tar.gz src-cf8fc527c9dc27e9e99a28c0c621bed2a74bc203.zip |
9512 zfs remap poolname@snapname coredumps
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.
illumos/illumos-gate@0b2e8253986c5c761129b58cfdac46d204903de1
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: John Wren Kennedy <john.kennedy@delphix.com>
Reviewed by: Sara Hartse <sara.hartse@delphix.com>
Approved by: Matt Ahrens <mahrens@delphix.com>
Author: loli10K <ezomori.nozomu@gmail.com>
Notes
Notes:
svn path=/vendor/illumos/dist/; revision=337161
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libzfs/common/libzfs_dataset.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/libzfs/common/libzfs_dataset.c b/lib/libzfs/common/libzfs_dataset.c index 556538a4402b..f91b9ecf6a76 100644 --- a/lib/libzfs/common/libzfs_dataset.c +++ b/lib/libzfs/common/libzfs_dataset.c @@ -3877,12 +3877,24 @@ zfs_remap_indirects(libzfs_handle_t *hdl, const char *fs) char errbuf[1024]; (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, - "cannot remap filesystem '%s' "), fs); + "cannot remap dataset '%s'"), fs); err = lzc_remap(fs); if (err != 0) { - (void) zfs_standard_error(hdl, err, errbuf); + switch (err) { + case ENOTSUP: + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "pool must be upgraded")); + (void) zfs_error(hdl, EZFS_BADVERSION, errbuf); + break; + case EINVAL: + (void) zfs_error(hdl, EZFS_BADTYPE, errbuf); + break; + default: + (void) zfs_standard_error(hdl, err, errbuf); + break; + } } return (err); |