changeset 10969:ed9b19e85c90

6893929 User/group quotas passed to "zfs create" are not properly set
author Matthew Ahrens <Matthew.Ahrens@Sun.COM>
date Thu, 05 Nov 2009 15:39:49 -0800
parents 7ccd43cefe5e
children 53b2abb98d0f
files usr/src/lib/libzfs/common/libzfs_dataset.c usr/src/uts/common/fs/zfs/zfs_ioctl.c
diffstat 2 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c	Thu Nov 05 15:01:10 2009 -0800
+++ b/usr/src/lib/libzfs/common/libzfs_dataset.c	Thu Nov 05 15:39:49 2009 -0800
@@ -815,9 +815,14 @@
 				goto error;
 			}
 
+			/*
+			 * Encode the prop name as
+			 * userquota@<hex-rid>-domain, to make it easy
+			 * for the kernel to decode.
+			 */
 			(void) snprintf(newpropname, sizeof (newpropname),
-			    "%s%s", zfs_userquota_prop_prefixes[uqtype],
-			    domain);
+			    "%s%llx-%s", zfs_userquota_prop_prefixes[uqtype],
+			    (longlong_t)rid, domain);
 			valary[0] = uqtype;
 			valary[1] = rid;
 			valary[2] = intval;
--- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c	Thu Nov 05 15:01:10 2009 -0800
+++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c	Thu Nov 05 15:39:49 2009 -0800
@@ -1729,8 +1729,11 @@
 				type = valary[0];
 				rid = valary[1];
 				quota = valary[2];
-				domain = propname +
-				    strlen(zfs_userquota_prop_prefixes[type]);
+				/*
+				 * The propname is encoded as
+				 * userquota@<rid>-<domain>.
+				 */
+				domain = strchr(propname, '-') + 1;
 
 				error = zfsvfs_hold(name, FTAG, &zfsvfs);
 				if (error == 0) {