Importing from cachefile can trip assertion

When importing from cachefile, it is possible that the builtin retry
logic will trip an assertion because it also fails to find the pool.
This fix addresses that case and returns the correct error message to
the user.

Reviewed-by: Richard Yao <ryao@gentoo.org>
Reviewed-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Wilson <gwilson@delphix.com>
Closes #13781
This commit is contained in:
George Wilson 2022-08-26 16:04:27 -05:00 committed by GitHub
parent 5bc0318047
commit 2d5622f5be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -1694,6 +1694,8 @@ zpool_find_import_cached(libpc_handle_t *hdl, importargs_t *iarg)
* caller. * caller.
*/ */
nvpair_t *pair = nvlist_next_nvpair(nv, NULL); nvpair_t *pair = nvlist_next_nvpair(nv, NULL);
if (pair == NULL)
continue;
fnvlist_add_nvlist(pools, nvpair_name(pair), fnvlist_add_nvlist(pools, nvpair_name(pair),
fnvpair_value_nvlist(pair)); fnvpair_value_nvlist(pair));