1431 prop = zfs_name_to_prop(propname);
1432
1433 if (prop == ZFS_PROP_VOLSIZE) {
1434 if ((added_resv = zfs_add_synthetic_resv(zhp, nvl)) == -1)
1435 goto error;
1436 }
1437
1438 if ((cl = changelist_gather(zhp, prop, 0, 0)) == NULL)
1439 goto error;
1440
1441 if (prop == ZFS_PROP_MOUNTPOINT && changelist_haszonedchild(cl)) {
1442 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1443 "child dataset with inherited mountpoint is used "
1444 "in a non-global zone"));
1445 ret = zfs_error(hdl, EZFS_ZONED, errbuf);
1446 goto error;
1447 }
1448
1449 /*
1450 * If the dataset's canmount property is being set to noauto,
1451 * then we want to prevent unmounting & remounting it.
1452 */
1453 do_prefix = !((prop == ZFS_PROP_CANMOUNT) &&
1454 (zprop_string_to_index(prop, propval, &idx,
1455 ZFS_TYPE_DATASET) == 0) && (idx == ZFS_CANMOUNT_NOAUTO));
1456
1457 if (do_prefix && (ret = changelist_prefix(cl)) != 0)
1458 goto error;
1459
1460 /*
1461 * Execute the corresponding ioctl() to set this property.
1462 */
1463 (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
1464
1465 if (zcmd_write_src_nvlist(hdl, &zc, nvl) != 0)
1466 goto error;
1467
1468 ret = zfs_ioctl(hdl, ZFS_IOC_SET_PROP, &zc);
1469
1470 if (ret != 0) {
1471 zfs_setprop_error(hdl, prop, errno, errbuf);
1472 if (added_resv && errno == ENOSPC) {
1473 /* clean up the volsize property we tried to set */
1474 uint64_t old_volsize = zfs_prop_get_int(zhp,
1475 ZFS_PROP_VOLSIZE);
|
1431 prop = zfs_name_to_prop(propname);
1432
1433 if (prop == ZFS_PROP_VOLSIZE) {
1434 if ((added_resv = zfs_add_synthetic_resv(zhp, nvl)) == -1)
1435 goto error;
1436 }
1437
1438 if ((cl = changelist_gather(zhp, prop, 0, 0)) == NULL)
1439 goto error;
1440
1441 if (prop == ZFS_PROP_MOUNTPOINT && changelist_haszonedchild(cl)) {
1442 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1443 "child dataset with inherited mountpoint is used "
1444 "in a non-global zone"));
1445 ret = zfs_error(hdl, EZFS_ZONED, errbuf);
1446 goto error;
1447 }
1448
1449 /*
1450 * If the dataset's canmount property is being set to noauto,
1451 * or being set to on and the dataset is already mounted,
1452 * then we want to prevent unmounting & remounting it.
1453 */
1454 do_prefix = !((prop == ZFS_PROP_CANMOUNT) &&
1455 (zprop_string_to_index(prop, propval, &idx,
1456 ZFS_TYPE_DATASET) == 0) && (idx == ZFS_CANMOUNT_NOAUTO ||
1457 (idx == ZFS_CANMOUNT_ON && zfs_is_mounted(zhp, NULL))));
1458
1459 if (do_prefix && (ret = changelist_prefix(cl)) != 0)
1460 goto error;
1461
1462 /*
1463 * Execute the corresponding ioctl() to set this property.
1464 */
1465 (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name));
1466
1467 if (zcmd_write_src_nvlist(hdl, &zc, nvl) != 0)
1468 goto error;
1469
1470 ret = zfs_ioctl(hdl, ZFS_IOC_SET_PROP, &zc);
1471
1472 if (ret != 0) {
1473 zfs_setprop_error(hdl, prop, errno, errbuf);
1474 if (added_resv && errno == ENOSPC) {
1475 /* clean up the volsize property we tried to set */
1476 uint64_t old_volsize = zfs_prop_get_int(zhp,
1477 ZFS_PROP_VOLSIZE);
|