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

zvol: Remove broken blk-mq optimization #15439

Closed
wants to merge 2 commits into from

Conversation

tonyhutter
Copy link
Contributor

Motivation and Context

Fixes: #15351

Description

This fix removes a dubious optimization in zfs_uiomove_bvec_rq() that saved the iterator contents of a rq_for_each_segment(). This optimization allowed restoring the "saved state" from a previous rq_for_each_segment() call on the same uio so that you wouldn't need to iterate though each bvec on every zfs_uiomove_bvec_rq() call. However, if the kernel is manipulating the requests/bios/bvecs under the covers between zfs_uiomove_bvec_rq() calls, then it could result in corruption from using the "saved state". This optimization results in an unbootable system after installing an OS on a zvol with blk-mq enabled.

With this PR applied the problem goes away.

How Has This Been Tested?

Tried to install both Ubuntu and Fedora from a blk-mq enabled zvol and verified both failed to boot after the install. Re-ran the same test with this patch applied and saw them both correctly boot.

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)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

This reverts commit aefb6a2.

aefb6a2 temporally disabled blk-mq until we could fix a fix for openzfs#15351.
We now have that fix (see next commit) fix so revert aefb6a2.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
This fix removes a dubious optimization in zfs_uiomove_bvec_rq() that saved the
iterator contents of a rq_for_each_segment().  This optimization allowed
restoring the "saved state" from a previous rq_for_each_segment() call on the
same uio so that you wouldn't need to iterate though each bvec on every
zfs_uiomove_bvec_rq() call.  However, if the kernel is manipulating the
requests/bios/bvecs under the covers between zfs_uiomove_bvec_rq() calls, then
it could result in corruption from using the "saved state".  This
optimization results in an unbootable system after installing an OS on a
zvol with blk-mq enabled.

Fixes: openzfs#15351
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Oct 24, 2023
ixhamza pushed a commit to truenas/zfs that referenced this pull request Nov 20, 2023
This reverts commit aefb6a2.

aefb6a2 temporally disabled blk-mq until we could fix a fix for

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes openzfs#15439
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Dec 12, 2023
This reverts commit aefb6a2.

aefb6a2 temporally disabled blk-mq until we could fix a fix for

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes openzfs#15439
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.

ZVOL data corruption with zvol_use_blk_mq=1
2 participants