summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGeorge Wilson <[email protected]>2022-08-26 16:04:27 -0500
committerTony Hutter <[email protected]>2022-09-13 17:59:04 -0700
commit15b64fbc94cc7aae1cef8787be2a36f677da92a7 (patch)
tree7967ceb6d3d8229c17854d6f274adbb269c5fbfb /lib
parentb1be0a5c151bb8f7d85430465c57d85d9be48075 (diff)
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 <[email protected]> Reviewed-by: Serapheim Dimitropoulos <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: George Wilson <[email protected]> Closes #13781
Diffstat (limited to 'lib')
-rw-r--r--lib/libzutil/zutil_import.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libzutil/zutil_import.c b/lib/libzutil/zutil_import.c
index f6f125e7a..165821519 100644
--- a/lib/libzutil/zutil_import.c
+++ b/lib/libzutil/zutil_import.c
@@ -1660,6 +1660,8 @@ zpool_find_import_cached(libpc_handle_t *hdl, importargs_t *iarg)
* caller.
*/
nvpair_t *pair = nvlist_next_nvpair(nv, NULL);
+ if (pair == NULL)
+ continue;
fnvlist_add_nvlist(pools, nvpair_name(pair),
fnvpair_value_nvlist(pair));