From 30231fcb2bfa673901be0dbf6e2b45382131a412 Mon Sep 17 00:00:00 2001 From: Ameer Hamza Date: Thu, 20 Oct 2022 23:05:08 +0500 Subject: [PATCH] zed: Avoid core dump if wholedisk property does not exist zed aborts and dumps core in vdev_whole_disk_from_config() if wholedisk property does not exist. make_leaf_vdev() adds the property but there may be already pools that don't have the wholedisk in the label. Signed-off-by: Ameer Hamza --- cmd/zed/agents/zfs_mod.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/zed/agents/zfs_mod.c b/cmd/zed/agents/zfs_mod.c index 44abb4eb9a34..cce56eec3265 100644 --- a/cmd/zed/agents/zfs_mod.c +++ b/cmd/zed/agents/zfs_mod.c @@ -948,14 +948,13 @@ vdev_whole_disk_from_config(zpool_handle_t *zhp, const char *vdev_path) { nvlist_t *nvl = NULL; boolean_t avail_spare, l2cache, log; - uint64_t wholedisk; + uint64_t wholedisk = 0; nvl = zpool_find_vdev(zhp, vdev_path, &avail_spare, &l2cache, &log); if (!nvl) return (0); - verify(nvlist_lookup_uint64(nvl, ZPOOL_CONFIG_WHOLE_DISK, - &wholedisk) == 0); + (void) nvlist_lookup_uint64(nvl, ZPOOL_CONFIG_WHOLE_DISK, &wholedisk); return (wholedisk); }