Print this page
2882 implement libzfs_core
2883 changing "canmount" property to "on" should not always remount dataset
2900 "zfs snapshot" should be able to create multiple, arbitrary snapshots at once
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Chris Siden <christopher.siden@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Bill Pijewski <wdp@joyent.com>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>
*** 2543,2552 ****
--- 2543,2558 ----
if (!dsl_scan_resilvering(spa->spa_dsl_pool) &&
vdev_resilver_needed(rvd, NULL, NULL))
spa_async_request(spa, SPA_ASYNC_RESILVER);
/*
+ * Log the fact that we booted up (so that we can detect if
+ * we rebooted in the middle of an operation).
+ */
+ spa_history_log_version(spa, "open");
+
+ /*
* Delete any inconsistent datasets.
*/
(void) dmu_objset_find(spa_name(spa),
dsl_destroy_inconsistent, NULL, DS_FIND_CHILDREN);
*** 3218,3228 ****
/*
* Pool Creation
*/
int
spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,
! const char *history_str, nvlist_t *zplprops)
{
spa_t *spa;
char *altroot = NULL;
vdev_t *rvd;
dsl_pool_t *dp;
--- 3224,3234 ----
/*
* Pool Creation
*/
int
spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,
! nvlist_t *zplprops)
{
spa_t *spa;
char *altroot = NULL;
vdev_t *rvd;
dsl_pool_t *dp;
*** 3437,3449 ****
*/
txg_wait_synced(spa->spa_dsl_pool, txg);
spa_config_sync(spa, B_FALSE, B_TRUE);
! if (version >= SPA_VERSION_ZPOOL_HISTORY && history_str != NULL)
! (void) spa_history_log(spa, history_str, LOG_CMD_POOL_CREATE);
! spa_history_log_version(spa, LOG_POOL_CREATE);
spa->spa_minref = refcount_count(&spa->spa_refcount);
mutex_exit(&spa_namespace_lock);
--- 3443,3453 ----
*/
txg_wait_synced(spa->spa_dsl_pool, txg);
spa_config_sync(spa, B_FALSE, B_TRUE);
! spa_history_log_version(spa, "create");
spa->spa_minref = refcount_count(&spa->spa_refcount);
mutex_exit(&spa_namespace_lock);
*** 3639,3649 ****
error = EINVAL;
goto out;
}
error = 0;
- spa_history_log_version(spa, LOG_POOL_IMPORT);
out:
spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
vdev_free(rvd);
spa_config_exit(spa, SCL_ALL, FTAG);
mutex_exit(&spa_namespace_lock);
--- 3643,3652 ----
*** 3701,3711 ****
spa_configfile_set(spa, props, B_FALSE);
spa_config_sync(spa, B_FALSE, B_TRUE);
mutex_exit(&spa_namespace_lock);
! spa_history_log_version(spa, LOG_POOL_IMPORT);
return (0);
}
spa_activate(spa, mode);
--- 3704,3714 ----
spa_configfile_set(spa, props, B_FALSE);
spa_config_sync(spa, B_FALSE, B_TRUE);
mutex_exit(&spa_namespace_lock);
! spa_history_log_version(spa, "import");
return (0);
}
spa_activate(spa, mode);
*** 3832,3842 ****
* We kick off an async task to handle this for us.
*/
spa_async_request(spa, SPA_ASYNC_AUTOEXPAND);
mutex_exit(&spa_namespace_lock);
! spa_history_log_version(spa, LOG_POOL_IMPORT);
return (0);
}
nvlist_t *
--- 3835,3845 ----
* We kick off an async task to handle this for us.
*/
spa_async_request(spa, SPA_ASYNC_AUTOEXPAND);
mutex_exit(&spa_namespace_lock);
! spa_history_log_version(spa, "import");
return (0);
}
nvlist_t *
*** 4370,4380 ****
/*
* Commit the config
*/
(void) spa_vdev_exit(spa, newrootvd, dtl_max_txg, 0);
! spa_history_log_internal(LOG_POOL_VDEV_ATTACH, spa, NULL,
"%s vdev=%s %s vdev=%s",
replacing && newvd_isspare ? "spare in" :
replacing ? "replace" : "attach", newvdpath,
replacing ? "for" : "to", oldvdpath);
--- 4373,4383 ----
/*
* Commit the config
*/
(void) spa_vdev_exit(spa, newrootvd, dtl_max_txg, 0);
! spa_history_log_internal(spa, "vdev attach", NULL,
"%s vdev=%s %s vdev=%s",
replacing && newvd_isspare ? "spare in" :
replacing ? "replace" : "attach", newvdpath,
replacing ? "for" : "to", oldvdpath);
*** 4587,4597 ****
/* hang on to the spa before we release the lock */
spa_open_ref(spa, FTAG);
error = spa_vdev_exit(spa, vd, txg, 0);
! spa_history_log_internal(LOG_POOL_VDEV_DETACH, spa, NULL,
"vdev=%s", vdpath);
spa_strfree(vdpath);
/*
* If this was the removal of the original device in a hot spare vdev,
--- 4590,4600 ----
/* hang on to the spa before we release the lock */
spa_open_ref(spa, FTAG);
error = spa_vdev_exit(spa, vd, txg, 0);
! spa_history_log_internal(spa, "detach", NULL,
"vdev=%s", vdpath);
spa_strfree(vdpath);
/*
* If this was the removal of the original device in a hot spare vdev,
*** 4856,4868 ****
dmu_tx_abort(tx);
for (c = 0; c < children; c++) {
if (vml[c] != NULL) {
vdev_split(vml[c]);
if (error == 0)
! spa_history_log_internal(LOG_POOL_VDEV_DETACH,
! spa, tx, "vdev=%s",
! vml[c]->vdev_path);
vdev_free(vml[c]);
}
}
vdev_config_dirty(spa->spa_root_vdev);
spa->spa_config_splitting = NULL;
--- 4859,4870 ----
dmu_tx_abort(tx);
for (c = 0; c < children; c++) {
if (vml[c] != NULL) {
vdev_split(vml[c]);
if (error == 0)
! spa_history_log_internal(spa, "detach", tx,
! "vdev=%s", vml[c]->vdev_path);
vdev_free(vml[c]);
}
}
vdev_config_dirty(spa->spa_root_vdev);
spa->spa_config_splitting = NULL;
*** 4873,4884 ****
if (zio_injection_enabled)
zio_handle_panic_injection(spa, FTAG, 3);
/* split is complete; log a history record */
! spa_history_log_internal(LOG_POOL_SPLIT, newspa, NULL,
! "split new pool %s from pool %s", newname, spa_name(spa));
kmem_free(vml, children * sizeof (vdev_t *));
/* if we're not going to mount the filesystems in userland, export */
if (exp)
--- 4875,4886 ----
if (zio_injection_enabled)
zio_handle_panic_injection(spa, FTAG, 3);
/* split is complete; log a history record */
! spa_history_log_internal(newspa, "split", NULL,
! "from pool %s", spa_name(spa));
kmem_free(vml, children * sizeof (vdev_t *));
/* if we're not going to mount the filesystems in userland, export */
if (exp)
*** 5460,5471 ****
/*
* If the pool grew as a result of the config update,
* then log an internal history event.
*/
if (new_space != old_space) {
! spa_history_log_internal(LOG_POOL_VDEV_ONLINE,
! spa, NULL,
"pool '%s' size: %llu(+%llu)",
spa_name(spa), new_space, new_space - old_space);
}
}
--- 5462,5472 ----
/*
* If the pool grew as a result of the config update,
* then log an internal history event.
*/
if (new_space != old_space) {
! spa_history_log_internal(spa, "vdev online", NULL,
"pool '%s' size: %llu(+%llu)",
spa_name(spa), new_space, new_space - old_space);
}
}
*** 5697,5706 ****
--- 5698,5708 ----
ASSERT(version <= SPA_VERSION);
ASSERT(version >= spa_version(spa));
spa->spa_uberblock.ub_version = version;
vdev_config_dirty(spa->spa_root_vdev);
+ spa_history_log_internal(spa, "set", tx, "version=%lld", version);
}
/*
* Set zpool properties.
*/
*** 5731,5740 ****
--- 5733,5744 ----
fname = strchr(nvpair_name(elem), '@') + 1;
VERIFY3U(0, ==, zfeature_lookup_name(fname, &feature));
spa_feature_enable(spa, feature, tx);
+ spa_history_log_internal(spa, "set", tx,
+ "%s=enabled", nvpair_name(elem));
break;
case ZPOOL_PROP_VERSION:
VERIFY(nvpair_value_uint64(elem, &intval) == 0);
/*
*** 5770,5779 ****
--- 5774,5785 ----
* to do this for pool creation since the vdev's
* configuratoin has already been dirtied.
*/
if (tx->tx_txg != TXG_INITIAL)
vdev_config_dirty(spa->spa_root_vdev);
+ spa_history_log_internal(spa, "set", tx,
+ "%s=%s", nvpair_name(elem), strval);
break;
default:
/*
* Set pool property values in the poolprops mos object.
*/
*** 5792,5802 ****
ASSERT(proptype == PROP_TYPE_STRING);
VERIFY(nvpair_value_string(elem, &strval) == 0);
VERIFY(zap_update(mos,
spa->spa_pool_props_object, propname,
1, strlen(strval) + 1, strval, tx) == 0);
!
} else if (nvpair_type(elem) == DATA_TYPE_UINT64) {
VERIFY(nvpair_value_uint64(elem, &intval) == 0);
if (proptype == PROP_TYPE_INDEX) {
const char *unused;
--- 5798,5809 ----
ASSERT(proptype == PROP_TYPE_STRING);
VERIFY(nvpair_value_string(elem, &strval) == 0);
VERIFY(zap_update(mos,
spa->spa_pool_props_object, propname,
1, strlen(strval) + 1, strval, tx) == 0);
! spa_history_log_internal(spa, "set", tx,
! "%s=%s", nvpair_name(elem), strval);
} else if (nvpair_type(elem) == DATA_TYPE_UINT64) {
VERIFY(nvpair_value_uint64(elem, &intval) == 0);
if (proptype == PROP_TYPE_INDEX) {
const char *unused;
*** 5804,5813 ****
--- 5811,5822 ----
prop, intval, &unused) == 0);
}
VERIFY(zap_update(mos,
spa->spa_pool_props_object, propname,
8, 1, &intval, tx) == 0);
+ spa_history_log_internal(spa, "set", tx,
+ "%s=%lld", nvpair_name(elem), intval);
} else {
ASSERT(0); /* not allowed */
}
switch (prop) {
*** 5832,5848 ****
default:
break;
}
}
- /* log internal history if this is not a zpool create */
- if (spa_version(spa) >= SPA_VERSION_ZPOOL_HISTORY &&
- tx->tx_txg != TXG_INITIAL) {
- spa_history_log_internal(LOG_POOL_PROPSET,
- spa, tx, "%s %lld %s",
- nvpair_name(elem), intval, spa_name(spa));
- }
}
mutex_exit(&spa->spa_props_lock);
}
--- 5841,5850 ----