Changeset View
Changeset View
Standalone View
Standalone View
sys/contrib/openzfs/cmd/zed/agents/zfs_agents.c
/* | /* | ||||
* CDDL HEADER START | * CDDL HEADER START | ||||
* | * | ||||
* The contents of this file are subject to the terms of the | * The contents of this file are subject to the terms of the | ||||
* Common Development and Distribution License Version 1.0 (CDDL-1.0). | * Common Development and Distribution License Version 1.0 (CDDL-1.0). | ||||
* You can obtain a copy of the license from the top-level file | * You can obtain a copy of the license from the top-level file | ||||
* "OPENSOLARIS.LICENSE" or at <http://opensource.org/licenses/CDDL-1.0>. | * "OPENSOLARIS.LICENSE" or at <http://opensource.org/licenses/CDDL-1.0>. | ||||
* You may not use this file except in compliance with the license. | * You may not use this file except in compliance with the license. | ||||
* | * | ||||
* CDDL HEADER END | * CDDL HEADER END | ||||
*/ | */ | ||||
/* | /* | ||||
* Copyright (c) 2016, Intel Corporation. | * Copyright (c) 2016, Intel Corporation. | ||||
* Copyright (c) 2018, loli10K <ezomori.nozomu@gmail.com> | * Copyright (c) 2018, loli10K <ezomori.nozomu@gmail.com> | ||||
* Copyright (c) 2021 Hewlett Packard Enterprise Development LP | |||||
*/ | */ | ||||
#include <libnvpair.h> | #include <libnvpair.h> | ||||
#include <libzfs.h> | #include <libzfs.h> | ||||
#include <stddef.h> | #include <stddef.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <sys/list.h> | #include <sys/list.h> | ||||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | if ((strcmp(class, EC_DEV_REMOVE) == 0) && | ||||
tod[0] = tv.tv_sec; | tod[0] = tv.tv_sec; | ||||
tod[1] = tv.tv_usec; | tod[1] = tv.tv_usec; | ||||
(void) nvlist_add_int64_array(payload, FM_EREPORT_TIME, tod, 2); | (void) nvlist_add_int64_array(payload, FM_EREPORT_TIME, tod, 2); | ||||
/* | /* | ||||
* For multipath, spare and l2arc devices ZFS_EV_VDEV_GUID or | * For multipath, spare and l2arc devices ZFS_EV_VDEV_GUID or | ||||
* ZFS_EV_POOL_GUID may be missing so find them. | * ZFS_EV_POOL_GUID may be missing so find them. | ||||
*/ | */ | ||||
(void) nvlist_lookup_string(nvl, DEV_IDENTIFIER, | if (pool_guid == 0 || vdev_guid == 0) { | ||||
&search.gs_devid); | if ((nvlist_lookup_string(nvl, DEV_IDENTIFIER, | ||||
(void) zpool_iter(g_zfs_hdl, zfs_agent_iter_pool, &search); | &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; | pool_guid = search.gs_pool_guid; | ||||
if (vdev_guid == 0) | |||||
vdev_guid = search.gs_vdev_guid; | vdev_guid = search.gs_vdev_guid; | ||||
devtype = search.gs_vdev_type; | devtype = search.gs_vdev_type; | ||||
} | |||||
} | |||||
/* | /* | ||||
* We want to avoid reporting "remove" events coming from | * We want to avoid reporting "remove" events coming from | ||||
* libudev for VDEVs which were expanded recently (10s) and | * libudev for VDEVs which were expanded recently (10s) and | ||||
* avoid activating spares in response to partitions being | * avoid activating spares in response to partitions being | ||||
* deleted and created in rapid succession. | * deleted and created in rapid succession. | ||||
*/ | */ | ||||
if (search.gs_vdev_expandtime != 0 && | if (search.gs_vdev_expandtime != 0 && | ||||
▲ Show 20 Lines • Show All 197 Lines • Show Last 20 Lines |