summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorTom Erickson <Tom.Erickson@Sun.COM>2010-01-15 13:13:56 -0800
committerTom Erickson <Tom.Erickson@Sun.COM>2010-01-15 13:13:56 -0800
commita79992aa86337b5472ea858477dfcdfe49945c80 (patch)
treeefcddcc228ab8d126037f30a8c3cbcdd6066d87e /usr/src
parent8175704f100a4d28687a2b2df9563d67194962bd (diff)
downloadillumos-gate-a79992aa86337b5472ea858477dfcdfe49945c80.tar.gz
6908211 'zfs inherit -S volsize <volume>' core dumps
6909909 memory leak in zfs_receive() 6916662 received mountpoint invalid after upgrade to zpool v22
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/zfs/zfs_main.c6
-rw-r--r--usr/src/lib/libzfs/common/libzfs_dataset.c18
-rw-r--r--usr/src/lib/libzfs/common/libzfs_sendrecv.c1
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_ioctl.c3
4 files changed, 25 insertions, 3 deletions
diff --git a/usr/src/cmd/zfs/zfs_main.c b/usr/src/cmd/zfs/zfs_main.c
index 9c800d2861..ce65fd57a8 100644
--- a/usr/src/cmd/zfs/zfs_main.c
+++ b/usr/src/cmd/zfs/zfs_main.c
@@ -1505,6 +1505,12 @@ zfs_do_inherit(int argc, char **argv)
"%s=none' to clear\n"), propname);
return (1);
}
+ if (received && (prop == ZFS_PROP_VOLSIZE ||
+ prop == ZFS_PROP_VERSION)) {
+ (void) fprintf(stderr, gettext("'%s' property cannot "
+ "be reverted to a received value\n"), propname);
+ return (1);
+ }
} else if (!zfs_prop_user(propname)) {
(void) fprintf(stderr, gettext("invalid property '%s'\n"),
propname);
diff --git a/usr/src/lib/libzfs/common/libzfs_dataset.c b/usr/src/lib/libzfs/common/libzfs_dataset.c
index 4097e0b340..8549117877 100644
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c
+++ b/usr/src/lib/libzfs/common/libzfs_dataset.c
@@ -1902,10 +1902,22 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
if (str[0] == '/') {
char buf[MAXPATHLEN];
char *root = buf;
- const char *relpath = zhp->zfs_name + strlen(source);
+ const char *relpath;
- if (relpath[0] == '/')
- relpath++;
+ /*
+ * If we inherit the mountpoint, even from a dataset
+ * with a received value, the source will be the path of
+ * the dataset we inherit from. If source is
+ * ZPROP_SOURCE_VAL_RECVD, the received value is not
+ * inherited.
+ */
+ if (strcmp(source, ZPROP_SOURCE_VAL_RECVD) == 0) {
+ relpath = "";
+ } else {
+ relpath = zhp->zfs_name + strlen(source);
+ if (relpath[0] == '/')
+ relpath++;
+ }
if ((zpool_get_prop(zhp->zpool_hdl,
ZPOOL_PROP_ALTROOT, buf, MAXPATHLEN, NULL)) ||
diff --git a/usr/src/lib/libzfs/common/libzfs_sendrecv.c b/usr/src/lib/libzfs/common/libzfs_sendrecv.c
index 65f9b66b60..472bc6446b 100644
--- a/usr/src/lib/libzfs/common/libzfs_sendrecv.c
+++ b/usr/src/lib/libzfs/common/libzfs_sendrecv.c
@@ -1535,6 +1535,7 @@ guid_to_name_cb(zfs_handle_t *zhp, void *arg)
if (zhp->zfs_dmustats.dds_guid == gtnd->guid) {
(void) strcpy(gtnd->name, zhp->zfs_name);
+ zfs_close(zhp);
return (EEXIST);
}
err = zfs_iter_children(zhp, guid_to_name_cb, gtnd);
diff --git a/usr/src/uts/common/fs/zfs/zfs_ioctl.c b/usr/src/uts/common/fs/zfs/zfs_ioctl.c
index bf24435c92..45450bb9b0 100644
--- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c
+++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c
@@ -2289,6 +2289,9 @@ zfs_ioc_inherit_prop(zfs_cmd_t *zc)
return (EINVAL);
type = PROP_TYPE_STRING;
+ } else if (prop == ZFS_PROP_VOLSIZE ||
+ prop == ZFS_PROP_VERSION) {
+ return (EINVAL);
} else {
type = zfs_prop_get_type(prop);
}