From ac7cedc3d73ba58d236d20bcd3c6b07492731762 Mon Sep 17 00:00:00 2001 From: Don Brady Date: Thu, 9 Dec 2021 14:02:56 -0700 Subject: [PATCH] DOSE-838 zpool iostat -o fails assertion when agent dies (#53) --- cmd/zpool/zpool_main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 73f8fae9ac2c..e5deb47733e2 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -5097,6 +5097,19 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv, if (strcmp(name, VDEV_TYPE_INDIRECT) == 0) return (ret); + /* + * When asked to display object store stats (-o), make sure the + * expected stats still exist. If they are missing we can skip + * printing this line and pick up on the next iteration. + */ + if (cb->cb_flags & IOS_OBJECT_ANY_M) { + if (!nvlist_exists(newnv, ZPOOL_CONFIG_OBJECT_STORE_STATS) || + (oldnv != NULL && + !nvlist_exists(oldnv, ZPOOL_CONFIG_OBJECT_STORE_STATS))) { + return (ret); + } + } + calcvs = safe_malloc(sizeof (*calcvs)); if (oldnv != NULL) {