diff usr/src/uts/common/fs/zfs/spa.c @ 4543:12bb2876a62e

PSARC/2006/465 ZFS Delegated Administration PSARC/2006/577 zpool property to disable delegation PSARC/2006/625 Enhancements to zpool history PSARC/2007/228 ZFS delegation amendments PSARC/2007/295 ZFS Delegated Administration Addendum 6280676 restore "owner" property 6349470 investigate non-root restore/backup 6572465 'zpool set bootfs=...' records history as 'zfs set bootfs=...'
author marks
date Tue, 26 Jun 2007 07:44:24 -0700
parents 5d5b6ba91b17
children ed36b0e652bc
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/spa.c	Mon Jun 25 23:50:40 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/spa.c	Tue Jun 26 07:44:24 2007 -0700
@@ -721,6 +721,8 @@
 		spa_config_exit(spa, FTAG);
 	}
 
+	spa->spa_delegation = zfs_prop_default_numeric(ZPOOL_PROP_DELEGATION);
+
 	error = zap_lookup(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
 	    DMU_POOL_PROPS, sizeof (uint64_t), 1, &spa->spa_pool_props_object);
 
@@ -740,6 +742,10 @@
 		    spa->spa_pool_props_object,
 		    zpool_prop_to_name(ZPOOL_PROP_AUTOREPLACE),
 		    sizeof (uint64_t), 1, &autoreplace);
+		(void) zap_lookup(spa->spa_meta_objset,
+		    spa->spa_pool_props_object,
+		    zpool_prop_to_name(ZPOOL_PROP_DELEGATION),
+		    sizeof (uint64_t), 1, &spa->spa_delegation);
 	}
 
 	/*
@@ -1258,6 +1264,7 @@
 	dmu_tx_commit(tx);
 
 	spa->spa_bootfs = zpool_prop_default_numeric(ZPOOL_PROP_BOOTFS);
+	spa->spa_delegation = zfs_prop_default_numeric(ZPOOL_PROP_DELEGATION);
 	spa->spa_sync_on = B_TRUE;
 	txg_sync_start(spa->spa_dsl_pool);
 
@@ -2957,7 +2964,7 @@
 }
 
 static void
-spa_sync_props(void *arg1, void *arg2, dmu_tx_t *tx)
+spa_sync_props(void *arg1, void *arg2, cred_t *cr, dmu_tx_t *tx)
 {
 	spa_t *spa = arg1;
 	nvlist_t *nvp = arg2;
@@ -2982,13 +2989,23 @@
 	nvpair = NULL;
 	while ((nvpair = nvlist_next_nvpair(nvp, nvpair))) {
 		switch (zpool_name_to_prop(nvpair_name(nvpair))) {
+		case ZPOOL_PROP_DELEGATION:
+			VERIFY(nvlist_lookup_uint64(nvp,
+			    nvpair_name(nvpair), &intval) == 0);
+			VERIFY(zap_update(mos,
+			    spa->spa_pool_props_object,
+			    nvpair_name(nvpair), 8, 1,
+			    &intval, tx) == 0);
+			spa->spa_delegation = intval;
+			break;
 		case ZPOOL_PROP_BOOTFS:
 			VERIFY(nvlist_lookup_uint64(nvp,
 			    nvpair_name(nvpair), &spa->spa_bootfs) == 0);
+			intval = spa->spa_bootfs;
 			VERIFY(zap_update(mos,
 			    spa->spa_pool_props_object,
 			    zpool_prop_to_name(ZPOOL_PROP_BOOTFS), 8, 1,
-			    &spa->spa_bootfs, tx) == 0);
+			    &intval, tx) == 0);
 			break;
 
 		case ZPOOL_PROP_AUTOREPLACE:
@@ -3000,6 +3017,10 @@
 			    &intval, tx) == 0);
 			break;
 		}
+		spa_history_internal_log(LOG_POOL_PROPSET,
+		    spa, tx, cr, "%s %lld %s",
+		    nvpair_name(nvpair), intval,
+		    spa->spa_name);
 	}
 }