Skip to content

Commit fb390aa

Browse files
Hans Rosenfeldbehlendorf
authored andcommitted
OpenZFS 5997 - FRU field not set during pool creation and never updated
Authored by: Hans Rosenfeld <hans.rosenfeld@nexenta.com> Reviewed by: Dan Fields <dan.fields@nexenta.com> Reviewed by: Josef Sipek <josef.sipek@nexenta.com> Reviewed by: Richard Elling <richard.elling@gmail.com> Reviewed by: George Wilson <george.wilson@delphix.com> Approved by: Robert Mustacchi <rm@joyent.com> Signed-off-by: Don Brady <don.brady@intel.com> Ported-by: Brian Behlendorf <behlendorf1@llnl.gov> OpenZFS-issue: https://www.illumos.org/issues/5997 OpenZFS-commit: openzfs/openzfs@1437283 Porting Notes: In addition to the OpenZFS changes this patch realigns the events with those found in OpenZFS. Events which would be logged as sysevents on illumos have been been mapped to the 'sysevent' class for Linux. In addition, several subclass names have been changed to match what is used in OpenZFS. In all cases this means a '.' was changed to an '_' in the subclass. The scripts provided by ZoL have been updated, however users which provide scripts for any of the following events will need to rename them based on the new subclass names. ereport.fs.zfs.config.sync sysevent.fs.zfs.config_sync ereport.fs.zfs.zpool.destroy sysevent.fs.zfs.pool_destroy ereport.fs.zfs.zpool.reguid sysevent.fs.zfs.pool_reguid ereport.fs.zfs.vdev.remove sysevent.fs.zfs.vdev_remove ereport.fs.zfs.vdev.clear sysevent.fs.zfs.vdev_clear ereport.fs.zfs.vdev.check sysevent.fs.zfs.vdev_check ereport.fs.zfs.vdev.spare sysevent.fs.zfs.vdev_spare ereport.fs.zfs.vdev.autoexpand sysevent.fs.zfs.vdev_autoexpand ereport.fs.zfs.resilver.start sysevent.fs.zfs.resilver_start ereport.fs.zfs.resilver.finish sysevent.fs.zfs.resilver_finish ereport.fs.zfs.scrub.start sysevent.fs.zfs.scrub_start ereport.fs.zfs.scrub.finish sysevent.fs.zfs.scrub_finish ereport.fs.zfs.bootfs.vdev.attach sysevent.fs.zfs.bootfs_vdev_attach
1 parent 834f1e4 commit fb390aa

22 files changed

+238
-305
lines changed

cmd/zed/Makefile.am

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ dist_zedexec_SCRIPTS = \
4949
zed.d/generic-notify.sh \
5050
zed.d/io-notify.sh \
5151
zed.d/io-spare.sh \
52-
zed.d/resilver.finish-notify.sh \
53-
zed.d/scrub.finish-notify.sh
52+
zed.d/resilver_finish-notify.sh \
53+
zed.d/scrub_finish-notify.sh
5454

5555
zedconfdefaults = \
5656
all-syslog.sh \
@@ -59,8 +59,8 @@ zedconfdefaults = \
5959
data-notify.sh \
6060
io-notify.sh \
6161
io-spare.sh \
62-
resilver.finish-notify.sh \
63-
scrub.finish-notify.sh
62+
resilver_finish-notify.sh \
63+
scrub_finish-notify.sh
6464

6565
install-data-hook:
6666
$(MKDIR_P) "$(DESTDIR)$(zedconfdir)"

cmd/zed/zed.d/resilver.finish-notify.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
scrub_finish-notify.sh

cmd/zed/zed.d/scrub.finish-notify.sh renamed to cmd/zed/zed.d/scrub_finish-notify.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/sh
22
#
3-
# Send notification in response to a RESILVER.FINISH or SCRUB.FINISH.
3+
# Send notification in response to a RESILVER_FINISH or SCRUB_FINISH.
44
#
5-
# By default, "zpool status" output will only be included for a scrub.finish
5+
# By default, "zpool status" output will only be included for a scrub_finish
66
# zevent if the pool is not healthy; to always include its output, set
77
# ZED_NOTIFY_VERBOSE=1.
88
#
@@ -19,9 +19,9 @@
1919
[ -n "${ZEVENT_POOL}" ] || exit 9
2020
[ -n "${ZEVENT_SUBCLASS}" ] || exit 9
2121

22-
if [ "${ZEVENT_SUBCLASS}" = "resilver.finish" ]; then
22+
if [ "${ZEVENT_SUBCLASS}" = "resilver_finish" ]; then
2323
action="resilver"
24-
elif [ "${ZEVENT_SUBCLASS}" = "scrub.finish" ]; then
24+
elif [ "${ZEVENT_SUBCLASS}" = "scrub_finish" ]; then
2525
action="scrub"
2626
else
2727
zed_log_err "unsupported event class \"${ZEVENT_SUBCLASS}\""
@@ -33,7 +33,7 @@ zed_check_cmd "${ZPOOL}" || exit 9
3333
# For scrub, suppress notification if the pool is healthy
3434
# and verbosity is not enabled.
3535
#
36-
if [ "${ZEVENT_SUBCLASS}" = "scrub.finish" ]; then
36+
if [ "${ZEVENT_SUBCLASS}" = "scrub_finish" ]; then
3737
healthy="$("${ZPOOL}" status -x "${ZEVENT_POOL}" \
3838
| grep "'${ZEVENT_POOL}' is healthy")"
3939
[ -n "${healthy}" ] && [ "${ZED_NOTIFY_VERBOSE}" -eq 0 ] && exit 3

cmd/zed/zed_event.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,9 +748,8 @@ _zed_event_add_env_preserve(uint64_t eid, zed_strings_t *zsp)
748748

749749
/*
750750
* Compute the "subclass" by removing the first 3 components of [class]
751-
* (which seem to always be either "ereport.fs.zfs" or "resource.fs.zfs").
752-
* Return a pointer inside the string [class], or NULL if insufficient
753-
* components exist.
751+
* (which will always be of the form "*.fs.zfs"). Return a pointer inside
752+
* the string [class], or NULL if insufficient components exist.
754753
*/
755754
static const char *
756755
_zed_event_get_subclass(const char *class)

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ AC_CONFIG_FILES([
8080
lib/libspl/include/ia32/sys/Makefile
8181
lib/libspl/include/rpc/Makefile
8282
lib/libspl/include/sys/Makefile
83-
lib/libspl/include/sys/sysevent/Makefile
8483
lib/libspl/include/sys/dktp/Makefile
8584
lib/libspl/include/util/Makefile
8685
lib/libavl/Makefile
@@ -134,6 +133,7 @@ AC_CONFIG_FILES([
134133
include/sys/fm/Makefile
135134
include/sys/fm/fs/Makefile
136135
include/sys/crypto/Makefile
136+
include/sys/sysevent/Makefile
137137
scripts/Makefile
138138
scripts/zpios-profile/Makefile
139139
scripts/zpios-test/Makefile

include/sys/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SUBDIRS = fm fs crypto
1+
SUBDIRS = fm fs crypto sysevent
22

33
COMMON_H = \
44
$(top_srcdir)/include/sys/arc.h \
@@ -52,6 +52,7 @@ COMMON_H = \
5252
$(top_srcdir)/include/sys/spa.h \
5353
$(top_srcdir)/include/sys/spa_impl.h \
5454
$(top_srcdir)/include/sys/spa_checksum.h \
55+
$(top_srcdir)/include/sys/sysevent.h \
5556
$(top_srcdir)/include/sys/trace.h \
5657
$(top_srcdir)/include/sys/trace_acl.h \
5758
$(top_srcdir)/include/sys/trace_arc.h \

include/sys/fm/fs/zfs.h

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ extern "C" {
3636
#define FM_EREPORT_ZFS_IO "io"
3737
#define FM_EREPORT_ZFS_DATA "data"
3838
#define FM_EREPORT_ZFS_DELAY "delay"
39-
#define FM_EREPORT_ZFS_CONFIG_SYNC "config.sync"
4039
#define FM_EREPORT_ZFS_POOL "zpool"
41-
#define FM_EREPORT_ZFS_POOL_DESTROY "zpool.destroy"
42-
#define FM_EREPORT_ZFS_POOL_REGUID "zpool.reguid"
4340
#define FM_EREPORT_ZFS_DEVICE_UNKNOWN "vdev.unknown"
4441
#define FM_EREPORT_ZFS_DEVICE_OPEN_FAILED "vdev.open_failed"
4542
#define FM_EREPORT_ZFS_DEVICE_CORRUPT_DATA "vdev.corrupt_data"
@@ -48,20 +45,10 @@ extern "C" {
4845
#define FM_EREPORT_ZFS_DEVICE_TOO_SMALL "vdev.too_small"
4946
#define FM_EREPORT_ZFS_DEVICE_BAD_LABEL "vdev.bad_label"
5047
#define FM_EREPORT_ZFS_DEVICE_BAD_ASHIFT "vdev.bad_ashift"
51-
#define FM_EREPORT_ZFS_DEVICE_REMOVE "vdev.remove"
52-
#define FM_EREPORT_ZFS_DEVICE_CLEAR "vdev.clear"
53-
#define FM_EREPORT_ZFS_DEVICE_CHECK "vdev.check"
54-
#define FM_EREPORT_ZFS_DEVICE_SPARE "vdev.spare"
55-
#define FM_EREPORT_ZFS_DEVICE_AUTOEXPAND "vdev.autoexpand"
5648
#define FM_EREPORT_ZFS_IO_FAILURE "io_failure"
5749
#define FM_EREPORT_ZFS_PROBE_FAILURE "probe_failure"
5850
#define FM_EREPORT_ZFS_LOG_REPLAY "log_replay"
5951
#define FM_EREPORT_ZFS_CONFIG_CACHE_WRITE "config_cache_write"
60-
#define FM_EREPORT_ZFS_RESILVER_START "resilver.start"
61-
#define FM_EREPORT_ZFS_RESILVER_FINISH "resilver.finish"
62-
#define FM_EREPORT_ZFS_SCRUB_START "scrub.start"
63-
#define FM_EREPORT_ZFS_SCRUB_FINISH "scrub.finish"
64-
#define FM_EREPORT_ZFS_BOOTFS_VDEV_ATTACH "bootfs.vdev.attach"
6552

6653
#define FM_EREPORT_PAYLOAD_ZFS_POOL "pool"
6754
#define FM_EREPORT_PAYLOAD_ZFS_POOL_FAILMODE "pool_failmode"
@@ -116,9 +103,9 @@ extern "C" {
116103
#define FM_EREPORT_FAILMODE_CONTINUE "continue"
117104
#define FM_EREPORT_FAILMODE_PANIC "panic"
118105

119-
#define FM_EREPORT_RESOURCE_REMOVED "removed"
120-
#define FM_EREPORT_RESOURCE_AUTOREPLACE "autoreplace"
121-
#define FM_EREPORT_RESOURCE_STATECHANGE "statechange"
106+
#define FM_RESOURCE_REMOVED "removed"
107+
#define FM_RESOURCE_AUTOREPLACE "autoreplace"
108+
#define FM_RESOURCE_STATECHANGE "statechange"
122109

123110
#ifdef __cplusplus
124111
}

include/sys/fm/protocol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ extern "C" {
5050
#define FM_RSRC_CLASS "resource"
5151
#define FM_LIST_EVENT "list"
5252
#define FM_IREPORT_CLASS "ireport"
53+
#define FM_SYSEVENT_CLASS "sysevent"
5354

5455
/* FM list.* event class values */
5556
#define FM_LIST_SUSPECT_CLASS FM_LIST_EVENT ".suspect"

include/sys/spa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,7 @@ extern void zfs_ereport_post(const char *class, spa_t *spa, vdev_t *vd,
851851
extern void zfs_post_remove(spa_t *spa, vdev_t *vd);
852852
extern void zfs_post_state_change(spa_t *spa, vdev_t *vd);
853853
extern void zfs_post_autoreplace(spa_t *spa, vdev_t *vd);
854+
extern void zfs_post_sysevent(spa_t *spa, vdev_t *vd, const char *name);
854855
extern uint64_t spa_get_errlog_size(spa_t *spa);
855856
extern int spa_get_errlog(spa_t *spa, void *uaddr, size_t *count);
856857
extern void spa_errlog_rotate(spa_t *spa);

0 commit comments

Comments
 (0)