Page MenuHomeFreeBSD

zfsd, the ZFS fault management daemon
ClosedPublic

Authored by asomers on May 26 2016, 12:51 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 10, 2:59 PM
Unknown Object (File)
Mon, Apr 1, 1:13 PM
Unknown Object (File)
Fri, Mar 22, 7:28 PM
Unknown Object (File)
Fri, Mar 22, 7:28 PM
Unknown Object (File)
Fri, Mar 22, 7:27 PM
Unknown Object (File)
Fri, Mar 22, 7:27 PM
Unknown Object (File)
Fri, Mar 22, 11:58 AM
Unknown Object (File)
Fri, Mar 22, 11:58 AM

Details

Summary

Add zfsd, which deals with hard drive faults in ZFS pools. It manages
hotspares and replements in drive slots that publish physical paths.

cddl/usr.sbin/zfsd
Add zfsd(8) and its unit tests

cddl/usr.sbin/Makefile
Add zfsd to the build

lib/libdevdctl
A C++ library that helps devd clients process events

lib/Makefile
share/mk/bsd.libnames.mk
share/mk/src.libnames.mk
Add libdevdctl to the build. It's a private library, unusable by
out-of-tree software.

etc/defaults/rc.conf
By default, set zfsd_enable to NO

etc/mtree/BSD.include.dist
Add a directory for libdevdctl's include files

etc/mtree/BSD.tests.dist
Add a directory for zfsd's unit tests

etc/mtree/BSD.var.dist
Add /var/db/zfsd/cases, where zfsd stores case files while it's shut
down.

etc/rc.d/Makefile
etc/rc.d/zfsd
Add zfsd's rc script

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
Fix the resource.fs.zfs.statechange message. It had a number of
problems:

  • It was only being emitted on a transition to the HEALTHY state.
	  That made it impossible for zfsd to take actions based on drives
	  getting sicker.
  • It compared the new state to vdev_prevstate, which is the state
	  that the vdev had the last time it was opened.  That doesn't make
	  sense, because a vdev can change state multiple times without
	  being reopened.
  • vdev_set_state contains logic that will change the device's new
	  state based on various conditions.  However, the statechange event
	  was being posted _before_ that logic took effect.  Now it's being
	  posted after.

sys/fs/devfs/devfs_vnops.c
Correct the rendering of device aliases that reside in
subdirectories of a devfs.

In devfs_readlink(), convert the devfs root relative path of an
alias's parent, that is recorded in the alias, into a fully
qualified path that includes the root of the containing devfs. This
avoids the ugliness of generating a relative path by prepending
"../"'s. For a non-jailed process, the "symlink root" is the
devfs's mount point. For a jailed process, we must remove any jail
prefix in the mount point so that our response matches the user
process's world view.

Test Plan

The zfsd unittests, included in this commit, and the zfsd functional
tests, in the zfsd project branch, at tests/sys/cddl/zfs/tests/zfsd

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

asomers retitled this revision from to zfsd, the ZFS fault management daemon.
asomers updated this object.
asomers edited the test plan for this revision. (Show Details)
asomers added reviewers: mav, gibbs, avg, allanjude, delphij.
asomers added a subscriber: ken.

Typo fix suggestions for comments.

cddl/usr.sbin/zfsd/callout.h
54 ↗(On Diff #16883)

s/granlarity/granularity/

114 ↗(On Diff #16883)

s/therfore/therefore/

148 ↗(On Diff #16883)

s/realtive/relative/

cddl/usr.sbin/zfsd/case_file.cc
669 ↗(On Diff #16883)

s/preseve/preserve/

cddl/usr.sbin/zfsd/case_file.h
219 ↗(On Diff #16883)

s/degrated/degraded/

cddl/usr.sbin/zfsd/zfsd.cc
319 ↗(On Diff #16883)

s/durring/during/

cddl/usr.sbin/zfsd/zfsd.h
177 ↗(On Diff #16883)

s/configuraiton/configuration/

cddl/usr.sbin/zfsd/zpool_list.h
91 ↗(On Diff #16883)

s/intantiated/instantiated/

lib/libdevdctl/consumer.h
79 ↗(On Diff #16883)

s/conumed/consumed/

lib/libdevdctl/event.h
160 ↗(On Diff #16883)

s/key's/keys/

173 ↗(On Diff #16883)

s/orginal/original/

lib/libdevdctl/event_factory.h
49 ↗(On Diff #16883)

s/creaction/creation/

lib/libdevdctl/exception.h
101 ↗(On Diff #16883)

s/encounterd/encountered/

lib/libdevdctl/guid.h
55 ↗(On Diff #16883)

superfluous "to"

Add a zfsd man page, courtesy of allanjude

asomers edited edge metadata.

Comment typo fixes suggested by @bcr

mav edited edge metadata.

We are using zfsd for quite some time in FreeNAS and it is working, so no objections.

This revision is now accepted and ready to land.May 27 2016, 7:47 AM

Please note that, zfsd is not using the standard 2-clause BSD license, which worries me, and I think this should be reviewed by core@. Will it be possible to relicense this under a standard license?

cddl/usr.sbin/zfsd/Makefile
13 ↗(On Diff #16917)

Not necessarily a problem, but I think LOCALBASE is undefined? Could you please check the output of 'make -V LOCALBASE' here?

cddl/usr.sbin/zfsd/vdev_iterator.cc
96 ↗(On Diff #16917)

Nitpicking -- for (;;)? (style(9)). Not a blocking issue.

delphij requested changes to this revision.May 27 2016, 5:05 PM
delphij edited edge metadata.

I think the devfs change would break chroot'ed applications (for instance those which requires /dev/random)? Is this portion needed by zfsd?

sys/fs/devfs/devfs_vnops.c
1352 ↗(On Diff #16917)

I think this would break chroot'ed processes? Is this change necessary for zfsd to function, or can we defer this a little bit while importing the rest of the code?

This revision now requires changes to proceed.May 27 2016, 5:05 PM

Please note that, zfsd is not using the standard 2-clause BSD license, which worries me, and I think this should be reviewed by core@. Will it be possible to relicense this under a standard license?

This is the language that @gibbs wants to be used more widely. Let's see what he says.

cddl/usr.sbin/zfsd/Makefile
13 ↗(On Diff #16917)

There are a lot of problems with that line, and they all derive from the fact that it depends on a port. Perhaps I should just unconditionally disable it. We can reenable it if and when we ever import googletest into the base, which is something @jmmv has expressed interest in.

sys/fs/devfs/devfs_vnops.c
1352 ↗(On Diff #16917)

The intention is to fix jailed processes that want to access /dev/enc@.../da nodes. I can defer it to a separate commit.

asomers edited edge metadata.

Address @delphij's concerns:

  • Style fix in vdev_iterator.cc
  • Unconditionally don't build zfsd's unittests automatically
  • Remove the change to devfs_vnops.c

Update copyright dates

Temporarily don't build libdevdctl in lib32; it was broken by r300770

delphij edited edge metadata.

LGTM (with reservation on the license part, I think we should consult with core@ or copyright owner).

This revision is now accepted and ready to land.May 28 2016, 6:21 AM
This revision was automatically updated to reflect the committed changes.