Print this page
3739 cannot set zfs quota or reservation on pool version < 22

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/dsl_dir.c
          +++ new/usr/src/uts/common/fs/zfs/dsl_dir.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright (c) 2013 by Delphix. All rights reserved.
       24 + * Copyright (c) 2013 Martin Matuska. All rights reserved.
  24   25   */
  25   26  
  26   27  #include <sys/dmu.h>
  27   28  #include <sys/dmu_objset.h>
  28   29  #include <sys/dmu_tx.h>
  29   30  #include <sys/dsl_dataset.h>
  30   31  #include <sys/dsl_dir.h>
  31   32  #include <sys/dsl_prop.h>
  32   33  #include <sys/dsl_synctask.h>
  33   34  #include <sys/dsl_deleg.h>
↓ open down ↓ 926 lines elided ↑ open up ↑
 960  961  static void
 961  962  dsl_dir_set_quota_sync(void *arg, dmu_tx_t *tx)
 962  963  {
 963  964          dsl_dir_set_qr_arg_t *ddsqra = arg;
 964  965          dsl_pool_t *dp = dmu_tx_pool(tx);
 965  966          dsl_dataset_t *ds;
 966  967          uint64_t newval;
 967  968  
 968  969          VERIFY0(dsl_dataset_hold(dp, ddsqra->ddsqra_name, FTAG, &ds));
 969  970  
 970      -        dsl_prop_set_sync_impl(ds, zfs_prop_to_name(ZFS_PROP_QUOTA),
 971      -            ddsqra->ddsqra_source, sizeof (ddsqra->ddsqra_value), 1,
 972      -            &ddsqra->ddsqra_value, tx);
      971 +        if (spa_version(dp->dp_spa) >= SPA_VERSION_RECVD_PROPS) {
      972 +                dsl_prop_set_sync_impl(ds, zfs_prop_to_name(ZFS_PROP_QUOTA),
      973 +                    ddsqra->ddsqra_source, sizeof (ddsqra->ddsqra_value), 1,
      974 +                    &ddsqra->ddsqra_value, tx);
 973  975  
 974      -        VERIFY0(dsl_prop_get_int_ds(ds,
 975      -            zfs_prop_to_name(ZFS_PROP_QUOTA), &newval));
      976 +                VERIFY0(dsl_prop_get_int_ds(ds,
      977 +                    zfs_prop_to_name(ZFS_PROP_QUOTA), &newval));
      978 +        } else {
      979 +                newval = ddsqra->ddsqra_value;
      980 +                spa_history_log_internal_ds(ds, "set", tx, "%s=%lld",
      981 +                    zfs_prop_to_name(ZFS_PROP_QUOTA), (longlong_t)newval);
      982 +        }
 976  983  
 977  984          dmu_buf_will_dirty(ds->ds_dir->dd_dbuf, tx);
 978  985          mutex_enter(&ds->ds_dir->dd_lock);
 979  986          ds->ds_dir->dd_phys->dd_quota = newval;
 980  987          mutex_exit(&ds->ds_dir->dd_lock);
 981  988          dsl_dataset_rele(ds, FTAG);
 982  989  }
 983  990  
 984  991  int
 985  992  dsl_dir_set_quota(const char *ddname, zprop_source_t source, uint64_t quota)
↓ open down ↓ 90 lines elided ↑ open up ↑
1076 1083  static void
1077 1084  dsl_dir_set_reservation_sync(void *arg, dmu_tx_t *tx)
1078 1085  {
1079 1086          dsl_dir_set_qr_arg_t *ddsqra = arg;
1080 1087          dsl_pool_t *dp = dmu_tx_pool(tx);
1081 1088          dsl_dataset_t *ds;
1082 1089          uint64_t newval;
1083 1090  
1084 1091          VERIFY0(dsl_dataset_hold(dp, ddsqra->ddsqra_name, FTAG, &ds));
1085 1092  
1086      -        dsl_prop_set_sync_impl(ds, zfs_prop_to_name(ZFS_PROP_RESERVATION),
1087      -            ddsqra->ddsqra_source, sizeof (ddsqra->ddsqra_value), 1,
1088      -            &ddsqra->ddsqra_value, tx);
     1093 +        if (spa_version(dp->dp_spa) >= SPA_VERSION_RECVD_PROPS) {
     1094 +                dsl_prop_set_sync_impl(ds,
     1095 +                    zfs_prop_to_name(ZFS_PROP_RESERVATION),
     1096 +                    ddsqra->ddsqra_source, sizeof (ddsqra->ddsqra_value), 1,
     1097 +                    &ddsqra->ddsqra_value, tx);
1089 1098  
1090      -        VERIFY0(dsl_prop_get_int_ds(ds,
1091      -            zfs_prop_to_name(ZFS_PROP_RESERVATION), &newval));
     1099 +                VERIFY0(dsl_prop_get_int_ds(ds,
     1100 +                    zfs_prop_to_name(ZFS_PROP_RESERVATION), &newval));
     1101 +        } else {
     1102 +                newval = ddsqra->ddsqra_value;
     1103 +                spa_history_log_internal_ds(ds, "set", tx, "%s=%lld",
     1104 +                    zfs_prop_to_name(ZFS_PROP_RESERVATION),
     1105 +                    (longlong_t)newval);
     1106 +        }
1092 1107  
1093 1108          dsl_dir_set_reservation_sync_impl(ds->ds_dir, newval, tx);
1094 1109          dsl_dataset_rele(ds, FTAG);
1095 1110  }
1096 1111  
1097 1112  int
1098 1113  dsl_dir_set_reservation(const char *ddname, zprop_source_t source,
1099 1114      uint64_t reservation)
1100 1115  {
1101 1116          dsl_dir_set_qr_arg_t ddsqra;
↓ open down ↓ 243 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX