HomeFreeBSD

Fix race condition with zed pidfile creation

Description

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

Details

Provenance
Chris Dunlap <cdunlap@llnl.gov>Authored on Aug 27 2014, 8:18 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Sep 2 2014, 9:18 PM
Parents
rG6c3c3387b1cc: Add a missing > to AUTHORS
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG5a8855b716ad: Fix race condition with zed pidfile creation (authored by Chris Dunlap <cdunlap@llnl.gov>).Sep 2 2014, 9:18 PM