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

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2013 Martin Matuska. All rights reserved.
  */
 
 #include <sys/dmu.h>
 #include <sys/dmu_objset.h>
 #include <sys/dmu_tx.h>

@@ -965,16 +966,22 @@
         dsl_dataset_t *ds;
         uint64_t newval;
 
         VERIFY0(dsl_dataset_hold(dp, ddsqra->ddsqra_name, FTAG, &ds));
 
+        if (spa_version(dp->dp_spa) >= SPA_VERSION_RECVD_PROPS) {
         dsl_prop_set_sync_impl(ds, zfs_prop_to_name(ZFS_PROP_QUOTA),
             ddsqra->ddsqra_source, sizeof (ddsqra->ddsqra_value), 1,
             &ddsqra->ddsqra_value, tx);
 
         VERIFY0(dsl_prop_get_int_ds(ds,
             zfs_prop_to_name(ZFS_PROP_QUOTA), &newval));
+        } else {
+                newval = ddsqra->ddsqra_value;
+                spa_history_log_internal_ds(ds, "set", tx, "%s=%lld",
+                    zfs_prop_to_name(ZFS_PROP_QUOTA), (longlong_t)newval);
+        }
 
         dmu_buf_will_dirty(ds->ds_dir->dd_dbuf, tx);
         mutex_enter(&ds->ds_dir->dd_lock);
         ds->ds_dir->dd_phys->dd_quota = newval;
         mutex_exit(&ds->ds_dir->dd_lock);

@@ -1081,16 +1088,24 @@
         dsl_dataset_t *ds;
         uint64_t newval;
 
         VERIFY0(dsl_dataset_hold(dp, ddsqra->ddsqra_name, FTAG, &ds));
 
-        dsl_prop_set_sync_impl(ds, zfs_prop_to_name(ZFS_PROP_RESERVATION),
+        if (spa_version(dp->dp_spa) >= SPA_VERSION_RECVD_PROPS) {
+                dsl_prop_set_sync_impl(ds,
+                    zfs_prop_to_name(ZFS_PROP_RESERVATION),
             ddsqra->ddsqra_source, sizeof (ddsqra->ddsqra_value), 1,
             &ddsqra->ddsqra_value, tx);
 
         VERIFY0(dsl_prop_get_int_ds(ds,
             zfs_prop_to_name(ZFS_PROP_RESERVATION), &newval));
+        } else {
+                newval = ddsqra->ddsqra_value;
+                spa_history_log_internal_ds(ds, "set", tx, "%s=%lld",
+                    zfs_prop_to_name(ZFS_PROP_RESERVATION),
+                    (longlong_t)newval);
+        }
 
         dsl_dir_set_reservation_sync_impl(ds->ds_dir, newval, tx);
         dsl_dataset_rele(ds, FTAG);
 }