svn commit: r329781 - vendor-sys/illumos/dist/uts/common/fs/zfs vendor/illumos/dist/lib/libzfs/common
Alexander Motin
mav at FreeBSD.org
Thu Feb 22 01:30:05 UTC 2018
Author: mav
Date: Thu Feb 22 01:30:03 2018
New Revision: 329781
URL: https://svnweb.freebsd.org/changeset/base/329781
Log:
8942 zfs promote .../%recv should be an error
illumos/illumos-gate at add927f8c8d101e16c23eb9cd270be4fd7edf7d5
Reported on the ZFSonLinux https://github.com/zfsonlinux/zfs/issues/4843,
fixed by https://github.com/zfsonlinux/zfs/pull/6339:
If we are in the middle of an incremental zfs receive, the child .../%recv
will exist. If you concurrently run zfs promote .../%recv, it will "work",
but then zfs gets confused. For example, there's no obvious way to destroy
the containing filesystem (because it is now a clone of its invisible child).
Attempting to do this promote should be an error. We could fix this by
having zfs_ioc_promote() check if zc_name contains a %, similar to
zfs_ioc_rename().
Reviewed by: Paul Dagnelie <pcd at delphix.com>
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Approved by: Dan McDonald <danmcd at joyent.com>
Author: loli10K <ezomori.nozomu at gmail.com>
Modified:
vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
Changes in other areas also in this revision:
Modified:
vendor-sys/illumos/dist/uts/common/fs/zfs/zfs_ioctl.c
Modified: vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c
==============================================================================
--- vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Thu Feb 22 01:25:28 2018 (r329780)
+++ vendor/illumos/dist/lib/libzfs/common/libzfs_dataset.c Thu Feb 22 01:30:03 2018 (r329781)
@@ -3737,6 +3737,9 @@ zfs_promote(zfs_handle_t *zhp)
return (zfs_error(hdl, EZFS_BADTYPE, errbuf));
}
+ if (!zfs_validate_name(hdl, zhp->zfs_name, zhp->zfs_type, B_TRUE))
+ return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf));
+
ret = lzc_promote(zhp->zfs_name, snapname, sizeof (snapname));
if (ret != 0) {
@@ -4093,6 +4096,10 @@ zfs_rename(zfs_handle_t *zhp, const char *target, bool
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
"cannot rename to '%s'"), target);
+
+ /* make sure source name is valid */
+ if (!zfs_validate_name(hdl, zhp->zfs_name, zhp->zfs_type, B_TRUE))
+ return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf));
/*
* Make sure the target name is valid
More information about the svn-src-vendor
mailing list