2014-01-22 01:30:03 +04:00
|
|
|
.\"
|
2020-10-09 06:10:13 +03:00
|
|
|
.\" This file is part of the ZFS Event Daemon (ZED).
|
2014-01-22 01:30:03 +04:00
|
|
|
.\" Developed at Lawrence Livermore National Laboratory (LLNL-CODE-403049).
|
|
|
|
.\" Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC.
|
2015-05-07 01:56:03 +03:00
|
|
|
.\" Refer to the ZoL git commit log for authoritative copyright attribution.
|
|
|
|
.\"
|
|
|
|
.\" The contents of this file are subject to the terms of the
|
|
|
|
.\" Common Development and Distribution License Version 1.0 (CDDL-1.0).
|
|
|
|
.\" You can obtain a copy of the license from the top-level file
|
|
|
|
.\" "OPENSOLARIS.LICENSE" or at <http://opensource.org/licenses/CDDL-1.0>.
|
|
|
|
.\" You may not use this file except in compliance with the license.
|
2014-01-22 01:30:03 +04:00
|
|
|
.\"
|
2020-08-25 07:25:28 +03:00
|
|
|
.TH ZED 8 "Aug 24, 2020" OpenZFS
|
2014-01-22 01:30:03 +04:00
|
|
|
|
|
|
|
.SH NAME
|
2014-09-19 22:10:28 +04:00
|
|
|
ZED \- ZFS Event Daemon
|
2014-01-22 01:30:03 +04:00
|
|
|
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.HP
|
|
|
|
.B zed
|
|
|
|
.\" [\fB\-c\fR \fIconfigfile\fR]
|
2014-09-19 22:10:28 +04:00
|
|
|
[\fB\-d\fR \fIzedletdir\fR]
|
2014-01-22 01:30:03 +04:00
|
|
|
[\fB\-f\fR]
|
|
|
|
[\fB\-F\fR]
|
|
|
|
[\fB\-h\fR]
|
zed additional features
This commit adds two features to zed, that macOS desires. The first
is that when you unload the kernel module, zed would enter into a
cpubusy loop calling zfs_events_next() repeatedly. We now look for
ENODEV, returned by kernel, so zed can exit gracefully.
Second feature is -I (idle) (alas -P persist was taken) is for the
deamon to;
1; if started without ZFS kernel module, stick around waiting for it.
2; if kernel module is unloaded, go back to 1.
This is due to daemons in macOS is started by launchctl, and is
expected to stick around.
Currently, the busy loop only exists when errno is ENODEV. This is
to ensure that functionality that upstream expects is not changed.
It did not care about errors before, and it still does not. (with the
exception of ENODEV).
However, it is probably better that all errors
(ERESTART notwithstanding) exits the loop, and the issues complaining
about zed taking all CPU will go away.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Closes #10476
2020-06-22 19:53:34 +03:00
|
|
|
[\fB\-I\fR]
|
2014-01-22 01:30:03 +04:00
|
|
|
[\fB\-L\fR]
|
|
|
|
[\fB\-M\fR]
|
|
|
|
[\fB\-p\fR \fIpidfile\fR]
|
2018-02-23 22:38:05 +03:00
|
|
|
[\fB\-P\fR \fIpath\fR]
|
2014-01-22 01:30:03 +04:00
|
|
|
[\fB\-s\fR \fIstatefile\fR]
|
|
|
|
[\fB\-v\fR]
|
|
|
|
[\fB\-V\fR]
|
|
|
|
[\fB\-Z\fR]
|
|
|
|
|
|
|
|
.SH DESCRIPTION
|
|
|
|
.PP
|
2014-09-19 22:10:28 +04:00
|
|
|
\fBZED\fR (ZFS Event Daemon) monitors events generated by the ZFS kernel
|
|
|
|
module. When a zevent (ZFS Event) is posted, \fBZED\fR will run any ZEDLETs
|
|
|
|
(ZFS Event Daemon Linkage for Executable Tasks) that have been enabled for the
|
|
|
|
corresponding zevent class.
|
2014-01-22 01:30:03 +04:00
|
|
|
|
|
|
|
.SH OPTIONS
|
|
|
|
.TP
|
|
|
|
.BI \-h
|
|
|
|
Display a summary of the command-line options.
|
|
|
|
.TP
|
|
|
|
.BI \-L
|
|
|
|
Display license information.
|
|
|
|
.TP
|
|
|
|
.BI \-V
|
|
|
|
Display version information.
|
|
|
|
.TP
|
|
|
|
.BI \-v
|
|
|
|
Be verbose.
|
|
|
|
.TP
|
|
|
|
.BI \-f
|
|
|
|
Force the daemon to run if at all possible, disabling security checks and
|
|
|
|
throwing caution to the wind. Not recommended for use in production.
|
|
|
|
.TP
|
|
|
|
.BI \-F
|
|
|
|
Run the daemon in the foreground.
|
|
|
|
.TP
|
|
|
|
.BI \-M
|
|
|
|
Lock all current and future pages in the virtual memory address space.
|
|
|
|
This may help the daemon remain responsive when the system is under heavy
|
|
|
|
memory pressure.
|
|
|
|
.TP
|
zed additional features
This commit adds two features to zed, that macOS desires. The first
is that when you unload the kernel module, zed would enter into a
cpubusy loop calling zfs_events_next() repeatedly. We now look for
ENODEV, returned by kernel, so zed can exit gracefully.
Second feature is -I (idle) (alas -P persist was taken) is for the
deamon to;
1; if started without ZFS kernel module, stick around waiting for it.
2; if kernel module is unloaded, go back to 1.
This is due to daemons in macOS is started by launchctl, and is
expected to stick around.
Currently, the busy loop only exists when errno is ENODEV. This is
to ensure that functionality that upstream expects is not changed.
It did not care about errors before, and it still does not. (with the
exception of ENODEV).
However, it is probably better that all errors
(ERESTART notwithstanding) exits the loop, and the issues complaining
about zed taking all CPU will go away.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Closes #10476
2020-06-22 19:53:34 +03:00
|
|
|
.BI \-I
|
|
|
|
Request that the daemon idle rather than exit when the kernel modules are
|
|
|
|
not loaded. Processing of events will start, or resume, when the kernel
|
|
|
|
modules are (re)loaded. Under Linux the kernel modules cannot be unloaded
|
|
|
|
while the daemon is running.
|
|
|
|
.TP
|
2014-01-22 01:30:03 +04:00
|
|
|
.BI \-Z
|
|
|
|
Zero the daemon's state, thereby allowing zevents still within the kernel
|
|
|
|
to be reprocessed.
|
|
|
|
.\" .TP
|
|
|
|
.\" .BI \-c\ configfile
|
|
|
|
.\" Read the configuration from the specified file.
|
|
|
|
.TP
|
2014-09-19 22:10:28 +04:00
|
|
|
.BI \-d\ zedletdir
|
|
|
|
Read the enabled ZEDLETs from the specified directory.
|
2014-01-22 01:30:03 +04:00
|
|
|
.TP
|
|
|
|
.BI \-p\ pidfile
|
|
|
|
Write the daemon's process ID to the specified file.
|
|
|
|
.TP
|
2018-02-23 22:38:05 +03:00
|
|
|
.BI \-P\ path
|
|
|
|
Custom $PATH for zedlets to use. Normally zedlets run in a locked-down
|
|
|
|
environment, with hardcoded paths to the ZFS commands ($ZFS, $ZPOOL, $ZED, ...),
|
|
|
|
and a hardcoded $PATH. This is done for security reasons. However, the
|
|
|
|
ZFS test suite uses a custom PATH for its ZFS commands, and passes it to zed
|
|
|
|
with -P. In short, -P is only to be used by the ZFS test suite; never use
|
|
|
|
it in production!
|
|
|
|
.TP
|
2014-01-22 01:30:03 +04:00
|
|
|
.BI \-s\ statefile
|
|
|
|
Write the daemon's state to the specified file.
|
|
|
|
.SH ZEVENTS
|
|
|
|
.PP
|
2014-09-19 22:10:28 +04:00
|
|
|
A zevent is comprised of a list of nvpairs (name/value pairs). Each zevent
|
2014-01-22 01:30:03 +04:00
|
|
|
contains an EID (Event IDentifier) that uniquely identifies it throughout
|
|
|
|
the lifetime of the loaded ZFS kernel module; this EID is a monotonically
|
|
|
|
increasing integer that resets to 1 each time the kernel module is loaded.
|
|
|
|
Each zevent also contains a class string that identifies the type of event.
|
|
|
|
For brevity, a subclass string is defined that omits the leading components
|
|
|
|
of the class string. Additional nvpairs exist to provide event details.
|
|
|
|
.PP
|
|
|
|
The kernel maintains a list of recent zevents that can be viewed (along with
|
|
|
|
their associated lists of nvpairs) using the "\fBzpool events \-v\fR" command.
|
|
|
|
|
|
|
|
.SH CONFIGURATION
|
|
|
|
.PP
|
2014-09-19 22:10:28 +04:00
|
|
|
ZEDLETs to be invoked in response to zevents are located in the
|
|
|
|
\fIenabled-zedlets\fR directory. These can be symlinked or copied from the
|
|
|
|
\fIinstalled-zedlets\fR directory; symlinks allow for automatic updates
|
|
|
|
from the installed ZEDLETs, whereas copies preserve local modifications.
|
|
|
|
As a security measure, ZEDLETs must be owned by root. They must have
|
|
|
|
execute permissions for the user, but they must not have write permissions
|
|
|
|
for group or other. Dotfiles are ignored.
|
2014-01-22 01:30:03 +04:00
|
|
|
.PP
|
2014-09-19 22:10:28 +04:00
|
|
|
ZEDLETs are named after the zevent class for which they should be invoked.
|
|
|
|
In particular, a ZEDLET will be invoked for a given zevent if either its
|
2014-01-22 01:30:03 +04:00
|
|
|
class or subclass string is a prefix of its filename (and is followed by
|
|
|
|
a non-alphabetic character). As a special case, the prefix "all" matches
|
2014-09-19 22:10:28 +04:00
|
|
|
all zevents. Multiple ZEDLETs may be invoked for a given zevent.
|
2014-01-22 01:30:03 +04:00
|
|
|
|
2014-09-19 22:10:28 +04:00
|
|
|
.SH ZEDLETS
|
2014-01-22 01:30:03 +04:00
|
|
|
.PP
|
2014-09-19 22:10:28 +04:00
|
|
|
ZEDLETs are executables invoked by the ZED in response to a given zevent.
|
|
|
|
They should be written under the presumption they can be invoked concurrently,
|
|
|
|
and they should use appropriate locking to access any shared resources.
|
|
|
|
Common variables used by ZEDLETs can be stored in the default rc file which
|
|
|
|
is sourced by scripts; these variables should be prefixed with "ZED_".
|
2014-01-22 01:30:03 +04:00
|
|
|
.PP
|
2014-09-19 22:10:28 +04:00
|
|
|
The zevent nvpairs are passed to ZEDLETs as environment variables.
|
2014-01-22 01:30:03 +04:00
|
|
|
Each nvpair name is converted to an environment variable in the following
|
|
|
|
manner: 1) it is prefixed with "ZEVENT_", 2) it is converted to uppercase,
|
|
|
|
and 3) each non-alphanumeric character is converted to an underscore.
|
|
|
|
Some additional environment variables have been defined to present certain
|
|
|
|
nvpair values in a more convenient form. An incomplete list of zevent
|
|
|
|
environment variables is as follows:
|
|
|
|
.TP
|
|
|
|
.B
|
|
|
|
ZEVENT_EID
|
|
|
|
The Event IDentifier.
|
|
|
|
.TP
|
|
|
|
.B
|
|
|
|
ZEVENT_CLASS
|
|
|
|
The zevent class string.
|
|
|
|
.TP
|
|
|
|
.B
|
|
|
|
ZEVENT_SUBCLASS
|
|
|
|
The zevent subclass string.
|
|
|
|
.TP
|
|
|
|
.B
|
|
|
|
ZEVENT_TIME
|
|
|
|
The time at which the zevent was posted as
|
|
|
|
"\fIseconds\fR\ \fInanoseconds\fR" since the Epoch.
|
|
|
|
.TP
|
|
|
|
.B
|
|
|
|
ZEVENT_TIME_SECS
|
|
|
|
The \fIseconds\fR component of ZEVENT_TIME.
|
|
|
|
.TP
|
|
|
|
.B
|
|
|
|
ZEVENT_TIME_NSECS
|
|
|
|
The \fInanoseconds\fR component of ZEVENT_TIME.
|
|
|
|
.TP
|
|
|
|
.B
|
|
|
|
ZEVENT_TIME_STRING
|
|
|
|
An almost-RFC3339-compliant string for ZEVENT_TIME.
|
|
|
|
.PP
|
|
|
|
Additionally, the following ZED & ZFS variables are defined:
|
|
|
|
.TP
|
|
|
|
.B
|
|
|
|
ZED_PID
|
|
|
|
The daemon's process ID.
|
|
|
|
.TP
|
|
|
|
.B
|
2014-09-19 22:10:28 +04:00
|
|
|
ZED_ZEDLET_DIR
|
|
|
|
The daemon's current \fIenabled-zedlets\fR directory.
|
2014-01-22 01:30:03 +04:00
|
|
|
.TP
|
|
|
|
.B
|
|
|
|
ZFS_ALIAS
|
2014-09-19 22:10:28 +04:00
|
|
|
The ZFS alias (\fIname-version-release\fR) string used to build the daemon.
|
2014-01-22 01:30:03 +04:00
|
|
|
.TP
|
|
|
|
.B
|
|
|
|
ZFS_VERSION
|
|
|
|
The ZFS version used to build the daemon.
|
|
|
|
.TP
|
|
|
|
.B
|
|
|
|
ZFS_RELEASE
|
|
|
|
The ZFS release used to build the daemon.
|
|
|
|
.PP
|
2014-09-19 22:10:28 +04:00
|
|
|
ZEDLETs may need to call other ZFS commands. The installation paths of
|
2014-01-22 01:30:03 +04:00
|
|
|
the following executables are defined: \fBZDB\fR, \fBZED\fR, \fBZFS\fR,
|
|
|
|
\fBZINJECT\fR, and \fBZPOOL\fR. These variables can be overridden in the
|
2014-09-19 22:10:28 +04:00
|
|
|
rc file if needed.
|
2014-01-22 01:30:03 +04:00
|
|
|
|
|
|
|
.SH FILES
|
|
|
|
.\" .TP
|
|
|
|
.\" @sysconfdir@/zfs/zed.conf
|
|
|
|
.\" The default configuration file for the daemon.
|
|
|
|
.TP
|
|
|
|
.I @sysconfdir@/zfs/zed.d
|
2014-09-19 22:10:28 +04:00
|
|
|
The default directory for enabled ZEDLETs.
|
2014-01-22 01:30:03 +04:00
|
|
|
.TP
|
|
|
|
.I @sysconfdir@/zfs/zed.d/zed.rc
|
2014-09-19 22:10:28 +04:00
|
|
|
The default rc file for common variables used by ZEDLETs.
|
2014-01-22 01:30:03 +04:00
|
|
|
.TP
|
2018-06-07 19:59:59 +03:00
|
|
|
.I @zfsexecdir@/zed.d
|
2014-09-19 22:10:28 +04:00
|
|
|
The default directory for installed ZEDLETs.
|
2014-01-22 01:30:03 +04:00
|
|
|
.TP
|
|
|
|
.I @runstatedir@/zed.pid
|
|
|
|
The default file containing the daemon's process ID.
|
|
|
|
.TP
|
|
|
|
.I @runstatedir@/zed.state
|
|
|
|
The default file containing the daemon's state.
|
|
|
|
|
|
|
|
.SH SIGNALS
|
|
|
|
.TP
|
|
|
|
.B HUP
|
2014-09-19 22:10:28 +04:00
|
|
|
Reconfigure the daemon and rescan the directory for enabled ZEDLETs.
|
2014-01-22 01:30:03 +04:00
|
|
|
.TP
|
|
|
|
.B TERM
|
|
|
|
Terminate the daemon.
|
|
|
|
|
|
|
|
.SH NOTES
|
|
|
|
.PP
|
2014-09-19 22:10:28 +04:00
|
|
|
\fBZED\fR requires root privileges.
|
2014-01-22 01:30:03 +04:00
|
|
|
.\" Do not taunt zed.
|
|
|
|
|
|
|
|
.SH BUGS
|
|
|
|
.PP
|
2014-09-19 22:10:28 +04:00
|
|
|
The ownership and permissions of the \fIenabled-zedlets\fR directory (along
|
2014-01-22 01:30:03 +04:00
|
|
|
with all parent directories) are not checked. If any of these directories
|
|
|
|
are improperly owned or permissioned, an unprivileged user could insert a
|
2014-09-19 22:10:28 +04:00
|
|
|
ZEDLET to be executed as root. The requirement that ZEDLETs be owned by
|
2014-01-22 01:30:03 +04:00
|
|
|
root mitigates this to some extent.
|
|
|
|
.PP
|
2014-09-19 22:10:28 +04:00
|
|
|
ZEDLETs are unable to return state/status information to the kernel.
|
2014-01-22 01:30:03 +04:00
|
|
|
.PP
|
|
|
|
Some zevent nvpair types are not handled. These are denoted by zevent
|
|
|
|
environment variables having a "_NOT_IMPLEMENTED_" value.
|
|
|
|
.PP
|
|
|
|
Internationalization support via gettext has not been added.
|
|
|
|
.PP
|
|
|
|
The configuration file is not yet implemented.
|
|
|
|
.PP
|
|
|
|
The diagnosis engine is not yet implemented.
|
|
|
|
|
|
|
|
.SH LICENSE
|
|
|
|
.PP
|
2014-09-19 22:10:28 +04:00
|
|
|
\fBZED\fR (ZFS Event Daemon) is distributed under the terms of the
|
2015-05-07 01:56:03 +03:00
|
|
|
Common Development and Distribution License Version 1.0 (CDDL\-1.0).
|
|
|
|
.PP
|
|
|
|
Developed at Lawrence Livermore National Laboratory (LLNL\-CODE\-403049).
|
2014-01-22 01:30:03 +04:00
|
|
|
|
|
|
|
.SH SEE ALSO
|
|
|
|
.BR zfs (8),
|
|
|
|
.BR zpool (8)
|
2019-11-13 20:21:07 +03:00
|
|
|
.BR zpool-events (8)
|