summaryrefslogtreecommitdiffstats
path: root/cddl
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2012-08-23 19:32:57 +0000
committermm <mm@FreeBSD.org>2012-08-23 19:32:57 +0000
commit587ce5b6a3a13d38b667f50272fe8ddf80b55acd (patch)
tree882f66554bf9020c93c7b164e6b1024effb50186 /cddl
parentba4876bedf0fe5642509d673ed733b6bba39e55a (diff)
downloadFreeBSD-src-587ce5b6a3a13d38b667f50272fe8ddf80b55acd.zip
FreeBSD-src-587ce5b6a3a13d38b667f50272fe8ddf80b55acd.tar.gz
Merge recent vendor changes:
3086 unnecessarily setting DS_FLAG_INCONSISTENT on async destroyed datasets 3090 vdev_reopen() during reguid causes vdev to be treated as corrupt 3102 vdev_uberblock_load() and vdev_validate() may read the wrong label Referenes: https://www.illumos.org/issues/3086 https://www.illumos.org/issues/3090 https://www.illumos.org/issues/3102 PR: kern/170912, kern/170914 Obtained from: illumos (changeset #13776, #13777) MFC after: 2 weeks
Diffstat (limited to 'cddl')
-rw-r--r--cddl/contrib/opensolaris/cmd/ztest/ztest.c26
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c85
2 files changed, 63 insertions, 48 deletions
diff --git a/cddl/contrib/opensolaris/cmd/ztest/ztest.c b/cddl/contrib/opensolaris/cmd/ztest/ztest.c
index db373e1..1f83eee 100644
--- a/cddl/contrib/opensolaris/cmd/ztest/ztest.c
+++ b/cddl/contrib/opensolaris/cmd/ztest/ztest.c
@@ -364,7 +364,7 @@ ztest_info_t ztest_info[] = {
{ ztest_spa_rename, 1, &zopt_rarely },
{ ztest_scrub, 1, &zopt_rarely },
{ ztest_dsl_dataset_promote_busy, 1, &zopt_rarely },
- { ztest_vdev_attach_detach, 1, &zopt_rarely },
+ { ztest_vdev_attach_detach, 1, &zopt_rarely },
{ ztest_vdev_LUN_growth, 1, &zopt_rarely },
{ ztest_vdev_add_remove, 1,
&ztest_opts.zo_vdevtime },
@@ -415,6 +415,13 @@ static spa_t *ztest_spa = NULL;
static ztest_ds_t *ztest_ds;
static mutex_t ztest_vdev_lock;
+
+/*
+ * The ztest_name_lock protects the pool and dataset namespace used by
+ * the individual tests. To modify the namespace, consumers must grab
+ * this lock as writer. Grabbing the lock as reader will ensure that the
+ * namespace does not change while the lock is held.
+ */
static rwlock_t ztest_name_lock;
static boolean_t ztest_dump_core = B_TRUE;
@@ -2225,6 +2232,7 @@ ztest_zil_remount(ztest_ds_t *zd, uint64_t id)
{
objset_t *os = zd->zd_os;
+ VERIFY(mutex_lock(&zd->zd_dirobj_lock) == 0);
(void) rw_wrlock(&zd->zd_zilog_lock);
/* zfsvfs_teardown() */
@@ -2235,6 +2243,7 @@ ztest_zil_remount(ztest_ds_t *zd, uint64_t id)
zil_replay(os, zd, ztest_replay_vector);
(void) rw_unlock(&zd->zd_zilog_lock);
+ VERIFY(mutex_unlock(&zd->zd_dirobj_lock) == 0);
}
/*
@@ -4860,10 +4869,16 @@ ztest_reguid(ztest_ds_t *zd, uint64_t id)
{
spa_t *spa = ztest_spa;
uint64_t orig, load;
+ int error;
orig = spa_guid(spa);
load = spa_load_guid(spa);
- if (spa_change_guid(spa) != 0)
+
+ (void) rw_wrlock(&ztest_name_lock);
+ error = spa_change_guid(spa);
+ (void) rw_unlock(&ztest_name_lock);
+
+ if (error != 0)
return;
if (ztest_opts.zo_verbose >= 3) {
@@ -5540,8 +5555,15 @@ ztest_freeze(void)
*/
kernel_init(FREAD | FWRITE);
VERIFY3U(0, ==, spa_open(ztest_opts.zo_pool, &spa, FTAG));
+ ASSERT(spa_freeze_txg(spa) == UINT64_MAX);
VERIFY3U(0, ==, ztest_dataset_open(0));
ztest_dataset_close(0);
+
+ spa->spa_debug = B_TRUE;
+ ztest_spa = spa;
+ txg_wait_synced(spa_get_dsl(spa), 0);
+ ztest_reguid(NULL, 0);
+
spa_close(spa, FTAG);
kernel_fini();
}
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
index 7e73d0f..7e39b0b 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
*/
/*
@@ -437,8 +437,8 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boolean_t active_ok)
uint_t i, nspares, nl2cache;
boolean_t config_seen;
uint64_t best_txg;
- char *name, *hostname, *comment;
- uint64_t version, guid;
+ char *name, *hostname;
+ uint64_t guid;
uint_t children = 0;
nvlist_t **child = NULL;
uint_t holes;
@@ -524,61 +524,54 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boolean_t active_ok)
* configuration:
*
* version
- * pool guid
- * name
+ * pool guid
+ * name
+ * pool txg (if available)
* comment (if available)
- * pool state
+ * pool state
* hostid (if available)
* hostname (if available)
*/
- uint64_t state;
+ uint64_t state, version, pool_txg;
+ char *comment = NULL;
+
+ version = fnvlist_lookup_uint64(tmp,
+ ZPOOL_CONFIG_VERSION);
+ fnvlist_add_uint64(config,
+ ZPOOL_CONFIG_VERSION, version);
+ guid = fnvlist_lookup_uint64(tmp,
+ ZPOOL_CONFIG_POOL_GUID);
+ fnvlist_add_uint64(config,
+ ZPOOL_CONFIG_POOL_GUID, guid);
+ name = fnvlist_lookup_string(tmp,
+ ZPOOL_CONFIG_POOL_NAME);
+ fnvlist_add_string(config,
+ ZPOOL_CONFIG_POOL_NAME, name);
- verify(nvlist_lookup_uint64(tmp,
- ZPOOL_CONFIG_VERSION, &version) == 0);
- if (nvlist_add_uint64(config,
- ZPOOL_CONFIG_VERSION, version) != 0)
- goto nomem;
- verify(nvlist_lookup_uint64(tmp,
- ZPOOL_CONFIG_POOL_GUID, &guid) == 0);
- if (nvlist_add_uint64(config,
- ZPOOL_CONFIG_POOL_GUID, guid) != 0)
- goto nomem;
- verify(nvlist_lookup_string(tmp,
- ZPOOL_CONFIG_POOL_NAME, &name) == 0);
- if (nvlist_add_string(config,
- ZPOOL_CONFIG_POOL_NAME, name) != 0)
- goto nomem;
+ if (nvlist_lookup_uint64(tmp,
+ ZPOOL_CONFIG_POOL_TXG, &pool_txg) == 0)
+ fnvlist_add_uint64(config,
+ ZPOOL_CONFIG_POOL_TXG, pool_txg);
- /*
- * COMMENT is optional, don't bail if it's not
- * there, instead, set it to NULL.
- */
if (nvlist_lookup_string(tmp,
- ZPOOL_CONFIG_COMMENT, &comment) != 0)
- comment = NULL;
- else if (nvlist_add_string(config,
- ZPOOL_CONFIG_COMMENT, comment) != 0)
- goto nomem;
+ ZPOOL_CONFIG_COMMENT, &comment) == 0)
+ fnvlist_add_string(config,
+ ZPOOL_CONFIG_COMMENT, comment);
- verify(nvlist_lookup_uint64(tmp,
- ZPOOL_CONFIG_POOL_STATE, &state) == 0);
- if (nvlist_add_uint64(config,
- ZPOOL_CONFIG_POOL_STATE, state) != 0)
- goto nomem;
+ state = fnvlist_lookup_uint64(tmp,
+ ZPOOL_CONFIG_POOL_STATE);
+ fnvlist_add_uint64(config,
+ ZPOOL_CONFIG_POOL_STATE, state);
hostid = 0;
if (nvlist_lookup_uint64(tmp,
ZPOOL_CONFIG_HOSTID, &hostid) == 0) {
- if (nvlist_add_uint64(config,
- ZPOOL_CONFIG_HOSTID, hostid) != 0)
- goto nomem;
- verify(nvlist_lookup_string(tmp,
- ZPOOL_CONFIG_HOSTNAME,
- &hostname) == 0);
- if (nvlist_add_string(config,
- ZPOOL_CONFIG_HOSTNAME,
- hostname) != 0)
- goto nomem;
+ fnvlist_add_uint64(config,
+ ZPOOL_CONFIG_HOSTID, hostid);
+ hostname = fnvlist_lookup_string(tmp,
+ ZPOOL_CONFIG_HOSTNAME);
+ fnvlist_add_string(config,
+ ZPOOL_CONFIG_HOSTNAME, hostname);
}
config_seen = B_TRUE;
OpenPOWER on IntegriCloud