From 2d5622f5be15e9e977a4c8fe5d24baaf487b0432 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Fri, 26 Aug 2022 16:04:27 -0500 Subject: [PATCH] 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 Reviewed-by: Serapheim Dimitropoulos Reviewed-by: Brian Behlendorf Signed-off-by: George Wilson Closes #13781 --- lib/libzutil/zutil_import.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libzutil/zutil_import.c b/lib/libzutil/zutil_import.c index 0bbf232f24..252b0bac68 100644 --- a/lib/libzutil/zutil_import.c +++ b/lib/libzutil/zutil_import.c @@ -1694,6 +1694,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));