Page MenuHomeFreeBSD

Fix race condition involving ZFS remove events
ClosedPublic

Authored by asomers on Jan 12 2016, 9:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 20, 6:27 PM
Unknown Object (File)
Fri, Dec 20, 12:57 PM
Unknown Object (File)
Wed, Dec 4, 3:00 AM
Unknown Object (File)
Thu, Nov 28, 6:57 PM
Unknown Object (File)
Sun, Nov 24, 11:57 PM
Unknown Object (File)
Nov 16 2024, 12:55 PM
Unknown Object (File)
Oct 3 2024, 11:41 PM
Unknown Object (File)
Oct 2 2024, 12:36 AM
Subscribers

Details

Summary

When a ZFS drive disappears, ZFS sends a resource.fs.zfs.removed event to
userland. A userland program like zfsd(8) can use that event, for example
to activate a hotspare. The current code contains a race condition:
vdev_geom will sent the sysevent _before_ spa.c would update the vdev's
status, causing userland processes to see pool state that does not reflect
the device removal. This change moves the sysevent to spa.c, closing the
race.

Test Plan

It's a race, so it's hard to test. But doing repeated iterations of the
following should work:

  1. Create a redundant zpool
  2. Start zfsd
  3. Pull a drive, wait 2 seconds
  4. Reinsert drive
  5. Check that the drive comes back online and resilvers
  6. Goto 3

Diff Detail

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

Event Timeline

asomers retitled this revision from to Fix race condition involving ZFS remove events.
asomers updated this object.
asomers edited the test plan for this revision. (Show Details)
asomers added a reviewer: delphij.
asomers added a subscriber: gibbs.

delphij, please let me know if you feel there would be someone better to review this change. I was looking for somebody from iXSystems, because I think they use ZFS's devctl events.

delphij edited edge metadata.

The change looks reasonable to me (I don't represent iXsystems, though). Can you make the similar change to vdev_disk.c and upstream?

This revision is now accepted and ready to land.Jan 13 2016, 8:46 AM
This revision was automatically updated to reflect the committed changes.