Skip to content

Notify userspace when a vdev is removed #11260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2020

Conversation

ghost
Copy link

@ghost ghost commented Dec 1, 2020

Motivation and Context

This is needed for zfsd to autoreplace vdevs on FreeBSD.

Description

Call zfs_post_remove() in spa_async_remove() to tell userspace that the vdev is gone.

How Has This Been Tested?

Tested on FreeBSD by setting autoremove=on, starting zfsd, and pulling out a device to confirm a spare replaces it.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

@ghost ghost requested a review from amotin December 1, 2020 15:13
Copy link
Member

@amotin amotin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FreeBSD had this for almost 5 years till OpenZFS import.

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense. Can you also update this comment in zfs_agent_post_event() which is now inaccurate to say something like "OpenZFS kernel modules older than 2.0 don't generate an FM_RESOURCE_REMOVED ereport from the vdev_disk layer after a hot unplug. Fortunately we do get an EC_DEV_REMOVE from our disk monitor and it is a suitable proxy so we remap it here for the benefit of the diagnosis engine. Processing multiple FM_RESOURCE_REMOVED events is not harmful.".

        /*
         * On Linux, we don't get the expected FM_RESOURCE_REMOVED ereport
         * from the vdev_disk layer after a hot unplug. Fortunately we do
         * get an EC_DEV_REMOVE from our disk monitor and it is a suitable
         * proxy so we remap it here for the benefit of the diagnosis engine.
         */

From my reading of the code it should be fine for the ZFS Event Daemon used on Linux to receive multiple copies of this event. So I think we just need to update the comment.

As an aside it looks like the only caller of this function was removed years ago with some other changes which is why it wasn't present in OpenZFS.

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Dec 1, 2020
This is needed for zfsd to autoreplace vdevs.

Signed-off-by: Ryan Moeller <[email protected]>
@ghost ghost force-pushed the zfs_post_remove branch from 4f89bb2 to da1bd1d Compare December 1, 2020 20:05
@ghost
Copy link
Author

ghost commented Dec 1, 2020

  • Update comment in zfs_agent_post_event

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Dec 2, 2020
@behlendorf behlendorf merged commit 0aacde2 into openzfs:master Dec 2, 2020
@ghost ghost deleted the zfs_post_remove branch December 2, 2020 18:39
ghost pushed a commit to zfsonfreebsd/ZoF that referenced this pull request Dec 23, 2020
This is needed for zfsd to autoreplace vdevs.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#11260
behlendorf pushed a commit that referenced this pull request Dec 23, 2020
This is needed for zfsd to autoreplace vdevs.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #11260
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
This is needed for zfsd to autoreplace vdevs.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#11260
sempervictus pushed a commit to sempervictus/zfs that referenced this pull request May 31, 2021
This is needed for zfsd to autoreplace vdevs.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#11260
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants