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

Fix zdb_read_block using zio after it is destroyed. #9657

Merged
merged 1 commit into from
Dec 3, 2019

Conversation

PaulZ-98
Copy link
Contributor

@PaulZ-98 PaulZ-98 commented Dec 2, 2019

The checksum display code of zdb_read_block uses a zio
to read in the block and then calls zio_checksum_compute.
Use a new zio in the call to zio_checksum_compute not the zio
from the read which has been destroyed by zio_wait.

Signed-off-by: Paul Zuchowski pzuchowski@datto.com
Fixes #9644

Motivation and Context

Test failure on DilOS - using a freed zio.

Description

When calling zio_checksum_compute, use a statically declared zio with io_bp and io_offset and io_spa set properly.

How Has This Been Tested?

Ran zfstest zdb section.

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:

cmd/zdb/zdb.c Outdated Show resolved Hide resolved
@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Dec 2, 2019
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.

Thanks, looks good after fixing the cstyle warning.

./cmd/zdb/zdb.c: 6612: line > 80 characters
Makefile:1593: recipe for target 'cstyle' failed

@behlendorf behlendorf requested a review from ikozhukhov December 2, 2019 19:14
The checksum display code of zdb_read_block uses a zio
to read in the block and then calls zio_checksum_compute.
Use a new zio in the call to zio_checksum_compute not the zio
from the read which has been destroyed by zio_wait.

Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Fixes openzfs#9644
@PaulZ-98
Copy link
Contributor Author

PaulZ-98 commented Dec 2, 2019

Wasn't sure if you fixed the style issue so just pushed that change.

@codecov
Copy link

codecov bot commented Dec 3, 2019

Codecov Report

Merging #9657 into master will increase coverage by 0.15%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9657      +/-   ##
==========================================
+ Coverage   79.32%   79.47%   +0.15%     
==========================================
  Files         418      418              
  Lines      123544   123549       +5     
==========================================
+ Hits        98003    98194     +191     
+ Misses      25541    25355     -186
Flag Coverage Δ
#kernel 80.02% <ø> (+0.08%) ⬆️
#user 67.29% <100%> (+0.4%) ⬆️

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 5142032...de552e5. Read the comment docs.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Dec 3, 2019
@behlendorf
Copy link
Contributor

Looks good. Let's just hold off until @ikozhukhov can verify the fix on dilos.

@ikozhukhov
Copy link
Contributor

confirm: new update fixed my problem, thanks!

Test: /opt/zfs-tests/tests/functional/cli_root/zdb/zdb_001_neg.ksh (run as root) [01:07] [PASS]
Test: /opt/zfs-tests/tests/functional/cli_root/zdb/zdb_002_pos.ksh (run as root) [00:19] [PASS]
Test: /opt/zfs-tests/tests/functional/cli_root/zdb/zdb_003_pos.ksh (run as root) [00:04] [PASS]
Test: /opt/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh (run as root) [00:05] [PASS]
Test: /opt/zfs-tests/tests/functional/cli_root/zdb/zdb_005_pos.ksh (run as root) [00:08] [PASS]
Test: /opt/zfs-tests/tests/functional/cli_root/zdb/zdb_006_pos.ksh (run as root) [00:41] [PASS]
Test: /opt/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh (run as root) [00:09] [PASS]

Copy link
Contributor

@ikozhukhov ikozhukhov left a comment

Choose a reason for hiding this comment

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

fixed, thanks

@behlendorf behlendorf merged commit 5a08977 into openzfs:master Dec 3, 2019
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Dec 26, 2019
The checksum display code of zdb_read_block uses a zio
to read in the block and then calls zio_checksum_compute.
Use a new zio in the call to zio_checksum_compute not the zio
from the read which has been destroyed by zio_wait.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes openzfs#9644
Closes openzfs#9657
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Dec 27, 2019
The checksum display code of zdb_read_block uses a zio
to read in the block and then calls zio_checksum_compute.
Use a new zio in the call to zio_checksum_compute not the zio
from the read which has been destroyed by zio_wait.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes openzfs#9644
Closes openzfs#9657
tonyhutter pushed a commit that referenced this pull request Jan 23, 2020
The checksum display code of zdb_read_block uses a zio
to read in the block and then calls zio_checksum_compute.
Use a new zio in the call to zio_checksum_compute not the zio
from the read which has been destroyed by zio_wait.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes #9644
Closes #9657
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.

regression with "Add display of checksums to zdb -R"
3 participants