6654731 sharesmb property should only be settable on CIFS aware ZPL
authormarks
Tue, 05 Feb 2008 14:44:45 -0800
changeset 5977 33727f49aeaa
parent 5976 b177556d43c5
child 5978 f182d580ff05
6654731 sharesmb property should only be settable on CIFS aware ZPL
usr/src/lib/libzfs/common/libzfs_dataset.c
usr/src/uts/common/fs/zfs/zfs_ioctl.c
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c	Tue Feb 05 11:45:22 2008 -0800
+++ b/usr/src/lib/libzfs/common/libzfs_dataset.c	Tue Feb 05 14:44:45 2008 -0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -1689,7 +1689,7 @@
 
 		case ENOTSUP:
 			zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
-			    "pool must be upgraded to set this "
+			    "pool and or dataset must be upgraded to set this "
 			    "property or value"));
 			(void) zfs_error(hdl, EZFS_BADVERSION, errbuf);
 			break;
--- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c	Tue Feb 05 11:45:22 2008 -0800
+++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c	Tue Feb 05 14:44:45 2008 -0800
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -175,6 +175,30 @@
 	return (0);
 }
 
+/*
+ * zpl_check_version
+ *
+ * Return non-zero if the ZPL version is less than requested version.
+ */
+static int
+zpl_check_version(const char *name, int version)
+{
+	objset_t *os;
+	int rc = 1;
+
+	if (dmu_objset_open(name, DMU_OST_ANY,
+	    DS_MODE_STANDARD | DS_MODE_READONLY, &os) == 0) {
+		uint64_t propversion;
+
+		if (zfs_get_zplprop(os, ZFS_PROP_VERSION,
+		    &propversion) == 0) {
+			rc = !(propversion >= version);
+		}
+		dmu_objset_close(os);
+	}
+	return (rc);
+}
+
 static void
 zfs_log_history(zfs_cmd_t *zc)
 {
@@ -1382,6 +1406,11 @@
 			if (zfs_check_version(name, SPA_VERSION_DITTO_BLOCKS))
 				return (ENOTSUP);
 			break;
+
+		case ZFS_PROP_SHARESMB:
+			if (zpl_check_version(name, ZPL_VERSION_FUID))
+				return (ENOTSUP);
+			break;
 		}
 		if ((error = zfs_secpolicy_setprop(name, prop, CRED())) != 0)
 			return (error);