mirror_zfs/cmd/zed
Chris Dunlap 5a8855b716 Fix race condition with zed pidfile creation
When the zed is started as a forking daemon (by default),
a race-condition exists where the parent process can terminate before
the pidfile has been created by the grandchild process.  When invoked
as a Type=forking systemd service, this can result in the following:

  systemd[1]: Starting ZFS Event Daemon (zed)...
  systemd[1]: PID file /var/run/zed.pid not readable (yet?) after start.

This commit adds a daemonize pipe to allow the grandchild process to
signal the parent process that initialization is complete (and the
pidfile has been created).  The parent process will wait for this
notification before exiting.

Signed-off-by: Chris Dunlap <cdunlap@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #2252
2014-09-02 14:18:53 -07:00
..
zed.d Add automatic hot spare functionality 2014-04-02 13:10:08 -07:00
.gitignore Initial implementation of zed (ZFS Event Daemon) 2014-04-02 13:10:03 -07:00
Makefile.am zed needs libzfs_core 2014-07-31 09:49:01 -07:00
zed_conf.c Fix race condition with zed pidfile creation 2014-09-02 14:18:53 -07:00
zed_conf.h Initial implementation of zed (ZFS Event Daemon) 2014-04-02 13:10:03 -07:00
zed_event.c Initial implementation of zed (ZFS Event Daemon) 2014-04-02 13:10:03 -07:00
zed_event.h Initial implementation of zed (ZFS Event Daemon) 2014-04-02 13:10:03 -07:00
zed_exec.c Initial implementation of zed (ZFS Event Daemon) 2014-04-02 13:10:03 -07:00
zed_exec.h Initial implementation of zed (ZFS Event Daemon) 2014-04-02 13:10:03 -07:00
zed_file.c Replace zed_file_create_dirs() with mkdirp() 2014-04-09 13:32:54 -07:00
zed_file.h Replace zed_file_create_dirs() with mkdirp() 2014-04-09 13:32:54 -07:00
zed_log.c Fix race condition with zed pidfile creation 2014-09-02 14:18:53 -07:00
zed_log.h Fix race condition with zed pidfile creation 2014-09-02 14:18:53 -07:00
zed_strings.c Initial implementation of zed (ZFS Event Daemon) 2014-04-02 13:10:03 -07:00
zed_strings.h Initial implementation of zed (ZFS Event Daemon) 2014-04-02 13:10:03 -07:00
zed.c Fix race condition with zed pidfile creation 2014-09-02 14:18:53 -07:00
zed.h Initial implementation of zed (ZFS Event Daemon) 2014-04-02 13:10:03 -07:00