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, Jul 5, 11:55 AM
Unknown Object (File)
Jun 7 2024, 9:41 AM
Unknown Object (File)
May 14 2024, 8:44 AM
Unknown Object (File)
May 7 2024, 8:42 PM
Unknown Object (File)
Jan 21 2024, 4:51 PM
Unknown Object (File)
Dec 31 2023, 3:42 PM
Unknown Object (File)
Nov 26 2023, 4:45 PM
Unknown Object (File)
Nov 13 2023, 1:45 PM
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.