Print this page
OS-1566 dataset quota for ZFS datasets

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/zfs_ioctl.c
          +++ new/usr/src/uts/common/fs/zfs/zfs_ioctl.c
↓ open down ↓ 609 lines elided ↑ open up ↑
 610  610          case ZFS_PROP_COMPRESSION:
 611  611          case ZFS_PROP_ZONED:
 612  612                  /*
 613  613                   * Disallow setting these properties from within a local zone.
 614  614                   */
 615  615                  if (!INGLOBALZONE(curproc))
 616  616                          return (EPERM);
 617  617                  break;
 618  618  
 619  619          case ZFS_PROP_QUOTA:
      620 +        case ZFS_PROP_DATASET_QUOTA:
      621 +        case ZFS_PROP_SNAPSHOT_QUOTA:
 620  622                  if (!INGLOBALZONE(curproc)) {
 621  623                          uint64_t zoned;
 622  624                          char setpoint[MAXNAMELEN];
 623  625                          /*
 624  626                           * Unprivileged users are allowed to modify the
 625  627                           * quota on things *under* (ie. contained by)
 626  628                           * the thing they own.
 627  629                           */
 628  630                          if (dsl_prop_get_integer(dsname, "zoned", &zoned,
 629  631                              setpoint))
↓ open down ↓ 1747 lines elided ↑ open up ↑
2377 2379  
2378 2380          VERIFY(0 == nvpair_value_uint64(pair, &intval));
2379 2381  
2380 2382          switch (prop) {
2381 2383          case ZFS_PROP_QUOTA:
2382 2384                  err = dsl_dir_set_quota(dsname, source, intval);
2383 2385                  break;
2384 2386          case ZFS_PROP_REFQUOTA:
2385 2387                  err = dsl_dataset_set_quota(dsname, source, intval);
2386 2388                  break;
     2389 +        case ZFS_PROP_DATASET_QUOTA:
     2390 +                err = dsl_dir_validate_ds_ss_quota(dsname, intval,
     2391 +                    ZFS_PROP_DATASET_QUOTA);
     2392 +                break;
     2393 +        case ZFS_PROP_SNAPSHOT_QUOTA:
     2394 +                err = dsl_dir_validate_ds_ss_quota(dsname, intval,
     2395 +                    ZFS_PROP_SNAPSHOT_QUOTA);
     2396 +                break;
2387 2397          case ZFS_PROP_RESERVATION:
2388 2398                  err = dsl_dir_set_reservation(dsname, source, intval);
2389 2399                  break;
2390 2400          case ZFS_PROP_REFRESERVATION:
2391 2401                  err = dsl_dataset_set_reservation(dsname, source, intval);
2392 2402                  break;
2393 2403          case ZFS_PROP_VOLSIZE:
2394 2404                  err = zvol_set_volsize(dsname, ddi_driver_major(zfs_dip),
2395 2405                      intval);
2396 2406                  break;
↓ open down ↓ 3555 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX