2387
2388 if (prop == ZPROP_INVAL) {
2389 if (zfs_prop_userquota(propname))
2390 return (zfs_prop_set_userquota(dsname, pair));
2391 return (-1);
2392 }
2393
2394 if (nvpair_type(pair) == DATA_TYPE_NVLIST) {
2395 nvlist_t *attrs;
2396 VERIFY(nvpair_value_nvlist(pair, &attrs) == 0);
2397 VERIFY(nvlist_lookup_nvpair(attrs, ZPROP_VALUE,
2398 &pair) == 0);
2399 }
2400
2401 if (zfs_prop_get_type(prop) == PROP_TYPE_STRING)
2402 return (-1);
2403
2404 VERIFY(0 == nvpair_value_uint64(pair, &intval));
2405
2406 switch (prop) {
2407 case ZFS_PROP_QUOTA:
2408 err = dsl_dir_set_quota(dsname, source, intval);
2409 break;
2410 case ZFS_PROP_REFQUOTA:
2411 err = dsl_dataset_set_refquota(dsname, source, intval);
2412 break;
2413 case ZFS_PROP_FILESYSTEM_LIMIT:
2414 case ZFS_PROP_SNAPSHOT_LIMIT:
2415 if (intval == UINT64_MAX) {
2416 /* clearing the limit, just do it */
2417 err = 0;
2418 } else {
2419 err = dsl_dir_activate_fs_ss_limit(dsname);
2420 }
2421 /*
2422 * Set err to -1 to force the zfs_set_prop_nvlist code down the
2423 * default path to set the value in the nvlist.
2424 */
2425 if (err == 0)
2426 err = -1;
|
2387
2388 if (prop == ZPROP_INVAL) {
2389 if (zfs_prop_userquota(propname))
2390 return (zfs_prop_set_userquota(dsname, pair));
2391 return (-1);
2392 }
2393
2394 if (nvpair_type(pair) == DATA_TYPE_NVLIST) {
2395 nvlist_t *attrs;
2396 VERIFY(nvpair_value_nvlist(pair, &attrs) == 0);
2397 VERIFY(nvlist_lookup_nvpair(attrs, ZPROP_VALUE,
2398 &pair) == 0);
2399 }
2400
2401 if (zfs_prop_get_type(prop) == PROP_TYPE_STRING)
2402 return (-1);
2403
2404 VERIFY(0 == nvpair_value_uint64(pair, &intval));
2405
2406 switch (prop) {
2407 case ZFS_PROP_FSID_GUID:
2408 err = dsl_dataset_set_fsid_guid(dsname, source, intval);
2409 break;
2410 case ZFS_PROP_QUOTA:
2411 err = dsl_dir_set_quota(dsname, source, intval);
2412 break;
2413 case ZFS_PROP_REFQUOTA:
2414 err = dsl_dataset_set_refquota(dsname, source, intval);
2415 break;
2416 case ZFS_PROP_FILESYSTEM_LIMIT:
2417 case ZFS_PROP_SNAPSHOT_LIMIT:
2418 if (intval == UINT64_MAX) {
2419 /* clearing the limit, just do it */
2420 err = 0;
2421 } else {
2422 err = dsl_dir_activate_fs_ss_limit(dsname);
2423 }
2424 /*
2425 * Set err to -1 to force the zfs_set_prop_nvlist code down the
2426 * default path to set the value in the nvlist.
2427 */
2428 if (err == 0)
2429 err = -1;
|