diff options
author | Brian Behlendorf <[email protected]> | 2012-10-18 21:36:07 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2012-10-22 08:46:02 -0700 |
commit | 30b937ee15589126b4e4576d09d664b93897fc25 (patch) | |
tree | d8b734e912373a7be5f6f9b131dbee004790ce47 | |
parent | eac4720465e54c86ae814667985c8a013ec45b85 (diff) |
Update spare and cache device names on import
During 'zpool import' all ZPOOL_CONFIG_PATH names are supposed
to be updated by fix_paths(). This was not happening for spare
and cache devices because the proper names were getting filtered
out of the pool_list_t->names. Interestingly, the names were
being filtered because the spare and cache devices do not
contain the pool name in their vdev label.
The fix is to exclude the device path from the list only if:
1) has a valid ZPOOL_CONFIG_POOL_NAME key in the label, and
2) that pool name does not match the specified pool name.
Since the label is valid and because it does properly store the
vdev guid it will be correctly assembled without the pool name.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #725
-rw-r--r-- | lib/libzfs/libzfs_import.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c index 98dc8788b..ad343e896 100644 --- a/lib/libzfs/libzfs_import.c +++ b/lib/libzfs/libzfs_import.c @@ -1142,14 +1142,15 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg) if (config != NULL) { boolean_t matched = B_TRUE; + char *pname; - if (iarg->poolname != NULL) { - char *pname; + if ((iarg->poolname != NULL) && + (nvlist_lookup_string(config, + ZPOOL_CONFIG_POOL_NAME, &pname) == 0)) { + + if (strcmp(iarg->poolname, pname)) + matched = B_FALSE; - matched = nvlist_lookup_string(config, - ZPOOL_CONFIG_POOL_NAME, - &pname) == 0 && - strcmp(iarg->poolname, pname) == 0; } else if (iarg->guid != 0) { uint64_t this_guid; |