Mercurial > illumos > illumos-gate
changeset 6957:ad855bd47277
6689844 ztest fails with "zdb: can't open ztest: No such device or address"
author | ck153898 |
---|---|
date | Wed, 25 Jun 2008 12:55:26 -0700 |
parents | 7372ebe9a3d7 |
children | 147b0193743c |
files | usr/src/cmd/zdb/zdb.c usr/src/cmd/zpool/zpool_main.c usr/src/lib/libzfs/common/libzfs.h usr/src/lib/libzfs/common/libzfs_import.c |
diffstat | 4 files changed, 30 insertions(+), 51 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/zdb/zdb.c Wed Jun 25 09:38:27 2008 -0700 +++ b/usr/src/cmd/zdb/zdb.c Wed Jun 25 12:55:26 2008 -0700 @@ -2315,21 +2315,16 @@ } static int -find_exported_zpool(char *pool_id, nvlist_t **configp, char *vdev_dir, - char *cachefile) +find_exported_zpool(char *pool_id, nvlist_t **configp, char *vdev_dir) { nvlist_t *pools; int error = ENOENT; nvlist_t *match = NULL; - if (vdev_dir != NULL) { + if (vdev_dir != NULL) pools = zpool_find_import_activeok(g_zfs, 1, &vdev_dir); - } else if (cachefile != NULL) { - pools = zpool_find_import_cached(g_zfs, cachefile, B_TRUE, - NULL, 0); - } else { + else pools = zpool_find_import_activeok(g_zfs, 0, NULL); - } if (pools != NULL) { nvpair_t *elem = NULL; @@ -2368,7 +2363,6 @@ int flag, set; int exported = 0; char *vdev_dir = NULL; - char *cachefile = NULL; (void) setrlimit(RLIMIT_NOFILE, &rl); (void) enable_extended_FILE_stdio(-1, -1); @@ -2436,7 +2430,7 @@ verbose++; break; case 'U': - cachefile = optarg; + spa_config_path = optarg; break; case 'e': exported = 1; @@ -2493,10 +2487,7 @@ if (argc < 1) { if (dump_opt['C']) { - if (cachefile != NULL) - dump_cachefile(cachefile); - else - dump_config(NULL); + dump_cachefile(spa_config_path); return (0); } usage(); @@ -2532,7 +2523,7 @@ dump_config(argv[0]); error = 0; - if (exported || cachefile != NULL) { + if (exported) { /* * Check to see if the name refers to an exported zpool */ @@ -2542,8 +2533,7 @@ if ((slash = strchr(argv[0], '/')) != NULL) *slash = '\0'; - error = find_exported_zpool(argv[0], &exported_conf, vdev_dir, - cachefile); + error = find_exported_zpool(argv[0], &exported_conf, vdev_dir); if (error == 0) { nvlist_t *nvl = NULL;
--- a/usr/src/cmd/zpool/zpool_main.c Wed Jun 25 09:38:27 2008 -0700 +++ b/usr/src/cmd/zpool/zpool_main.c Wed Jun 25 12:55:26 2008 -0700 @@ -1474,8 +1474,8 @@ } if (cachefile) { - pools = zpool_find_import_cached(g_zfs, cachefile, B_FALSE, - searchname, searchguid); + pools = zpool_find_import_cached(g_zfs, cachefile, searchname, + searchguid); } else if (searchname != NULL) { pools = zpool_find_import_byname(g_zfs, nsearch, searchdirs, searchname);
--- a/usr/src/lib/libzfs/common/libzfs.h Wed Jun 25 09:38:27 2008 -0700 +++ b/usr/src/lib/libzfs/common/libzfs.h Wed Jun 25 12:55:26 2008 -0700 @@ -298,7 +298,7 @@ */ extern nvlist_t *zpool_find_import(libzfs_handle_t *, int, char **); extern nvlist_t *zpool_find_import_cached(libzfs_handle_t *, const char *, - boolean_t, char *, uint64_t); + char *, uint64_t); extern nvlist_t *zpool_find_import_byname(libzfs_handle_t *, int, char **, char *); extern nvlist_t *zpool_find_import_byguid(libzfs_handle_t *, int, char **,
--- a/usr/src/lib/libzfs/common/libzfs_import.c Wed Jun 25 09:38:27 2008 -0700 +++ b/usr/src/lib/libzfs/common/libzfs_import.c Wed Jun 25 12:55:26 2008 -0700 @@ -980,7 +980,7 @@ */ nvlist_t * zpool_find_import_cached(libzfs_handle_t *hdl, const char *cachefile, - boolean_t active_ok, char *poolname, uint64_t guid) + char *poolname, uint64_t guid) { char *buf; int fd; @@ -1063,40 +1063,29 @@ continue; } - if (!active_ok) { - if (pool_active(hdl, name, this_guid, &active) != 0) { - nvlist_free(raw); - nvlist_free(pools); - return (NULL); - } + if (pool_active(hdl, name, this_guid, &active) != 0) { + nvlist_free(raw); + nvlist_free(pools); + return (NULL); + } - if (active) - continue; - - if ((dst = refresh_config(hdl, src)) == NULL) { - nvlist_free(raw); - nvlist_free(pools); - return (NULL); - } + if (active) + continue; - if (nvlist_add_nvlist(pools, nvpair_name(elem), dst) - != 0) { - (void) no_memory(hdl); - nvlist_free(dst); - nvlist_free(raw); - nvlist_free(pools); - return (NULL); - } + if ((dst = refresh_config(hdl, src)) == NULL) { + nvlist_free(raw); + nvlist_free(pools); + return (NULL); + } + + if (nvlist_add_nvlist(pools, nvpair_name(elem), dst) != 0) { + (void) no_memory(hdl); nvlist_free(dst); - } else { - if (nvlist_add_nvlist(pools, nvpair_name(elem), src) - != 0) { - (void) no_memory(hdl); - nvlist_free(raw); - nvlist_free(pools); - return (NULL); - } + nvlist_free(raw); + nvlist_free(pools); + return (NULL); } + nvlist_free(dst); } nvlist_free(raw);