-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
zvol_os: Code cleanup #11117
Closed
Closed
zvol_os: Code cleanup #11117
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using more specific assert variants gives better messages on failure. No functional change. Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
zvol_geom_close gets a count of the number of close operations to do. Make sure we're always using this count to check if this will be the last close operation performed on the zvol. Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Nonfunctional changes for readability and consistency. Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
We fall back to a default volmode and continue when looking up a zvol's volmode property fails. After this we should set the error to 0 to ensure we take the success paths in the out section. While here, make sure we only log that the zvol was created on success. Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Make sure to free doi in zvol_create_minor impl when make_dev_s fails. Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
zvol private data is supposed to be nulled by zvol_clear_private before zvol_free is called as an indicator that the zvol is going away. Implement zvol_clear_private for volmode=dev. Assert that zvol_clear_private has been called before zvol_free. Check that zvol_clear_private has not been called when updating volsize. If it has, fail with ENXIO. Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
ghost
added
Component: ZVOL
ZFS Volumes
Status: Code Review Needed
Ready for review and testing
labels
Oct 27, 2020
amotin
approved these changes
Oct 27, 2020
mattmacy
approved these changes
Oct 27, 2020
Codecov Report
@@ Coverage Diff @@
## master #11117 +/- ##
=======================================
Coverage 79.81% 79.82%
=======================================
Files 398 398
Lines 125754 125757 +3
=======================================
+ Hits 100367 100381 +14
+ Misses 25387 25376 -11
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
behlendorf
added
Status: Accepted
Ready to integrate (reviewed, tested)
and removed
Status: Code Review Needed
Ready for review and testing
labels
Oct 30, 2020
behlendorf
pushed a commit
that referenced
this pull request
Oct 30, 2020
zvol_geom_close gets a count of the number of close operations to do. Make sure we're always using this count to check if this will be the last close operation performed on the zvol. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11117
behlendorf
pushed a commit
that referenced
this pull request
Oct 30, 2020
Nonfunctional changes for readability and consistency. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11117
behlendorf
pushed a commit
that referenced
this pull request
Oct 30, 2020
We fall back to a default volmode and continue when looking up a zvol's volmode property fails. After this we should set the error to 0 to ensure we take the success paths in the out section. While here, make sure we only log that the zvol was created on success. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11117
behlendorf
pushed a commit
that referenced
this pull request
Oct 30, 2020
Make sure to free doi in zvol_create_minor impl when make_dev_s fails. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11117
behlendorf
pushed a commit
that referenced
this pull request
Oct 30, 2020
zvol private data is supposed to be nulled by zvol_clear_private before zvol_free is called as an indicator that the zvol is going away. Implement zvol_clear_private for volmode=dev. Assert that zvol_clear_private has been called before zvol_free. Check that zvol_clear_private has not been called when updating volsize. If it has, fail with ENXIO. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11117
behlendorf
pushed a commit
that referenced
this pull request
Oct 30, 2020
Using more specific assert variants gives better messages on failure. No functional change. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11117
behlendorf
pushed a commit
that referenced
this pull request
Oct 30, 2020
zvol_geom_close gets a count of the number of close operations to do. Make sure we're always using this count to check if this will be the last close operation performed on the zvol. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11117
behlendorf
pushed a commit
that referenced
this pull request
Oct 30, 2020
Nonfunctional changes for readability and consistency. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11117
behlendorf
pushed a commit
that referenced
this pull request
Oct 30, 2020
We fall back to a default volmode and continue when looking up a zvol's volmode property fails. After this we should set the error to 0 to ensure we take the success paths in the out section. While here, make sure we only log that the zvol was created on success. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11117
behlendorf
pushed a commit
that referenced
this pull request
Oct 30, 2020
Make sure to free doi in zvol_create_minor impl when make_dev_s fails. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11117
behlendorf
pushed a commit
that referenced
this pull request
Oct 30, 2020
zvol private data is supposed to be nulled by zvol_clear_private before zvol_free is called as an indicator that the zvol is going away. Implement zvol_clear_private for volmode=dev. Assert that zvol_clear_private has been called before zvol_free. Check that zvol_clear_private has not been called when updating volsize. If it has, fail with ENXIO. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11117
ghost
deleted the
zvol-audit
branch
October 30, 2020 23:46
jsai20
pushed a commit
to jsai20/zfs
that referenced
this pull request
Mar 30, 2021
Using more specific assert variants gives better messages on failure. No functional change. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes openzfs#11117
jsai20
pushed a commit
to jsai20/zfs
that referenced
this pull request
Mar 30, 2021
zvol_geom_close gets a count of the number of close operations to do. Make sure we're always using this count to check if this will be the last close operation performed on the zvol. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes openzfs#11117
jsai20
pushed a commit
to jsai20/zfs
that referenced
this pull request
Mar 30, 2021
Nonfunctional changes for readability and consistency. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes openzfs#11117
jsai20
pushed a commit
to jsai20/zfs
that referenced
this pull request
Mar 30, 2021
We fall back to a default volmode and continue when looking up a zvol's volmode property fails. After this we should set the error to 0 to ensure we take the success paths in the out section. While here, make sure we only log that the zvol was created on success. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes openzfs#11117
jsai20
pushed a commit
to jsai20/zfs
that referenced
this pull request
Mar 30, 2021
Make sure to free doi in zvol_create_minor impl when make_dev_s fails. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes openzfs#11117
jsai20
pushed a commit
to jsai20/zfs
that referenced
this pull request
Mar 30, 2021
zvol private data is supposed to be nulled by zvol_clear_private before zvol_free is called as an indicator that the zvol is going away. Implement zvol_clear_private for volmode=dev. Assert that zvol_clear_private has been called before zvol_free. Check that zvol_clear_private has not been called when updating volsize. If it has, fail with ENXIO. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes openzfs#11117
sempervictus
pushed a commit
to sempervictus/zfs
that referenced
this pull request
May 31, 2021
Using more specific assert variants gives better messages on failure. No functional change. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes openzfs#11117
sempervictus
pushed a commit
to sempervictus/zfs
that referenced
this pull request
May 31, 2021
zvol_geom_close gets a count of the number of close operations to do. Make sure we're always using this count to check if this will be the last close operation performed on the zvol. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes openzfs#11117
sempervictus
pushed a commit
to sempervictus/zfs
that referenced
this pull request
May 31, 2021
Nonfunctional changes for readability and consistency. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes openzfs#11117
sempervictus
pushed a commit
to sempervictus/zfs
that referenced
this pull request
May 31, 2021
We fall back to a default volmode and continue when looking up a zvol's volmode property fails. After this we should set the error to 0 to ensure we take the success paths in the out section. While here, make sure we only log that the zvol was created on success. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes openzfs#11117
sempervictus
pushed a commit
to sempervictus/zfs
that referenced
this pull request
May 31, 2021
Make sure to free doi in zvol_create_minor impl when make_dev_s fails. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes openzfs#11117
sempervictus
pushed a commit
to sempervictus/zfs
that referenced
this pull request
May 31, 2021
zvol private data is supposed to be nulled by zvol_clear_private before zvol_free is called as an indicator that the zvol is going away. Implement zvol_clear_private for volmode=dev. Assert that zvol_clear_private has been called before zvol_free. Check that zvol_clear_private has not been called when updating volsize. If it has, fail with ENXIO. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Matt Macy <mmacy@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes openzfs#11117
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Various issues were found while investigating -o volmode=xxx being ignored on FreeBSD when creating a zvol.
These commits do not fix the volmode issue, but a separate FreeBSD issue is fixed where changing volmode after creation would not take effect until the next time the pool is imported or the zvol is renamed.
Description
Tidy up asserts (FreeBSD & Linux):
Keep better track of open count in close (FreeBSD):
Code cleanup in zvol_create_minor_impl (FreeBSD):
Properly ignore error in volmode lookup (FreeBSD):
Don't leak doi in cdev error path (FreeBSD):
Fix handling of zvol private data (FreeBSD):
How Has This Been Tested?
ZTS on FreeBSD; manual messing with the volmode property
Types of changes
Checklist:
Signed-off-by
.