diff options
author | nssrikanth <[email protected]> | 2021-02-05 22:00:50 +0530 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-05 08:30:50 -0800 |
commit | 32366649d3164e994def7e5a26765ca6bc1e2315 (patch) | |
tree | ed85fd7e95942cdbeaeea31831de244973a45915 /cmd | |
parent | d66f017c1775952a1923031039fdfb1ac28a34f4 (diff) |
Fixed issue with processing of EC_dev_remove event
The pool guid and vdev guid received by zfs_agent_post_event(),
which calls zfs_retire_recv(), are normally non-zero. However,
later in this same method they may be unconditionally reset to
zero by the code which is intended to handle multipath, spare
and l2arc vdevs. This will result in the EC_dev_remove not
being handled.
Reviewed-by: Brian Behlendorf <[email protected]>\
Co-authored-by: Vipin Kumar Verma <[email protected]>
Signed-off-by: Srikanth N S <[email protected]>
Closes #11564
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/zed/agents/zfs_agents.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/cmd/zed/agents/zfs_agents.c b/cmd/zed/agents/zfs_agents.c index 0e1bcf927..67b7951b0 100644 --- a/cmd/zed/agents/zfs_agents.c +++ b/cmd/zed/agents/zfs_agents.c @@ -13,6 +13,7 @@ /* * Copyright (c) 2016, Intel Corporation. * Copyright (c) 2018, loli10K <[email protected]> + * Copyright (c) 2021 Hewlett Packard Enterprise Development LP */ #include <libnvpair.h> @@ -211,12 +212,18 @@ zfs_agent_post_event(const char *class, const char *subclass, nvlist_t *nvl) * For multipath, spare and l2arc devices ZFS_EV_VDEV_GUID or * ZFS_EV_POOL_GUID may be missing so find them. */ - (void) nvlist_lookup_string(nvl, DEV_IDENTIFIER, - &search.gs_devid); - (void) zpool_iter(g_zfs_hdl, zfs_agent_iter_pool, &search); - pool_guid = search.gs_pool_guid; - vdev_guid = search.gs_vdev_guid; - devtype = search.gs_vdev_type; + if (pool_guid == 0 || vdev_guid == 0) { + if ((nvlist_lookup_string(nvl, DEV_IDENTIFIER, + &search.gs_devid) == 0) && + (zpool_iter(g_zfs_hdl, zfs_agent_iter_pool, &search) + == 1)) { + if (pool_guid == 0) + pool_guid = search.gs_pool_guid; + if (vdev_guid == 0) + vdev_guid = search.gs_vdev_guid; + devtype = search.gs_vdev_type; + } + } /* * We want to avoid reporting "remove" events coming from |