Skip to content
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

FreeBSD: Simplify zvol and fix locking #10381

Merged
merged 1 commit into from
Jun 3, 2020

Conversation

ghost
Copy link

@ghost ghost commented May 27, 2020

Motivation and Context

zvol_geom_bio_strategy should handle its own use of the zvol
suspend reader lock and ensure the zilog exists when needed.

A few other places using the zvol zilog should use the suspend
reader lock as well.

Description

Simplify consumers of zvol_geom_bio_strategy, fix the locking, and
while in here, use the boolean_t constants with doread.

How Has This Been Tested?

ZTS on FreeBSD:
Screen Shot 2020-05-27 at 1 11 12 PM

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:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the contributing document.
  • I have added tests to cover my changes.
  • I have run the ZFS Test Suite with this change applied.
  • All commit messages are properly formatted and contain Signed-off-by.

@ghost ghost added Component: ZVOL ZFS Volumes Status: Code Review Needed Ready for review and testing labels May 27, 2020
@ghost ghost requested a review from amotin May 27, 2020 17:13
@codecov-commenter
Copy link

Codecov Report

Merging #10381 into master will decrease coverage by 13.38%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #10381       +/-   ##
===========================================
- Coverage   79.38%   66.00%   -13.39%     
===========================================
  Files         391      308       -83     
  Lines      123590   106289    -17301     
===========================================
- Hits        98112    70151    -27961     
- Misses      25478    36138    +10660     
Flag Coverage Δ
#kernel ?
#user 66.00% <ø> (+0.49%) ⬆️
Impacted Files Coverage Δ
module/zfs/objlist.c 0.00% <0.00%> (-100.00%) ⬇️
module/zfs/pathname.c 0.00% <0.00%> (-100.00%) ⬇️
include/sys/dmu_redact.h 0.00% <0.00%> (-100.00%) ⬇️
include/sys/dmu_traverse.h 0.00% <0.00%> (-100.00%) ⬇️
module/zfs/zfs_rlock.c 0.00% <0.00%> (-96.36%) ⬇️
module/lua/ltablib.c 2.34% <0.00%> (-95.32%) ⬇️
module/zfs/bqueue.c 0.00% <0.00%> (-94.45%) ⬇️
module/zcommon/zfs_deleg.c 0.00% <0.00%> (-92.46%) ⬇️
module/zfs/dmu_diff.c 0.00% <0.00%> (-87.88%) ⬇️
module/zfs/zcp_set.c 0.00% <0.00%> (-87.10%) ⬇️
... and 240 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce98ed2...af35ec7. Read the comment docs.

@codecov-commenter
Copy link

codecov-commenter commented May 28, 2020

Codecov Report

Merging #10381 into master will decrease coverage by 13.36%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #10381       +/-   ##
===========================================
- Coverage   79.38%   66.02%   -13.37%     
===========================================
  Files         391      308       -83     
  Lines      123590   106289    -17301     
===========================================
- Hits        98112    70176    -27936     
- Misses      25478    36113    +10635     
Flag Coverage Δ
#kernel ?
#user 66.02% <ø> (+0.52%) ⬆️
Impacted Files Coverage Δ
module/zfs/objlist.c 0.00% <0.00%> (-100.00%) ⬇️
module/zfs/pathname.c 0.00% <0.00%> (-100.00%) ⬇️
include/sys/dmu_redact.h 0.00% <0.00%> (-100.00%) ⬇️
include/sys/dmu_traverse.h 0.00% <0.00%> (-100.00%) ⬇️
module/zfs/zfs_rlock.c 0.00% <0.00%> (-96.36%) ⬇️
module/lua/ltablib.c 2.34% <0.00%> (-95.32%) ⬇️
module/zfs/bqueue.c 0.00% <0.00%> (-94.45%) ⬇️
module/zcommon/zfs_deleg.c 0.00% <0.00%> (-92.46%) ⬇️
module/zfs/dmu_diff.c 0.00% <0.00%> (-87.88%) ⬇️
module/zfs/zcp_set.c 0.00% <0.00%> (-87.10%) ⬇️
... and 236 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce98ed2...a0e474b. Read the comment docs.

@ghost
Copy link
Author

ghost commented May 29, 2020

@mattmacy can you give this some eyeballs

@mattmacy
Copy link
Contributor

mattmacy commented Jun 1, 2020

Seems fine.

zvol_geom_bio_strategy should handle its own use of the zvol
suspend reader lock and ensure the zilog exists when needed.

A few other places using the zvol zilog should use the suspend
reader lock as well.

Simplify consumers of zvol_geom_bio_strategy, fix the locking, and
while in here, use the boolean_t constants with doread.

Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
@ghost ghost force-pushed the fbsd-zvol-locking branch from af35ec7 to a0e474b Compare June 2, 2020 17:15
@ghost
Copy link
Author

ghost commented Jun 2, 2020

  • Skip over exiting the suspend lock when not held

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.

Looks good to me.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Jun 3, 2020
@behlendorf behlendorf merged commit c0eb5c3 into openzfs:master Jun 3, 2020
@ghost ghost deleted the fbsd-zvol-locking branch June 3, 2020 17:46
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
zvol_geom_bio_strategy should handle its own use of the zvol
suspend reader lock and ensure the zilog exists when needed.

A few other places using the zvol zilog should use the suspend
reader lock as well.

Simplify consumers of zvol_geom_bio_strategy, fix the locking, and
while in here, use the boolean_t constants with doread.

Reviewed-by: Matt Macy <mmacy@FreeBSD.org>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes openzfs#10381
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: ZVOL ZFS Volumes Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants