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

Better disambiguate incomplete and corrupted streams on receive #10122

Merged
merged 1 commit into from
Mar 17, 2020

Conversation

pcd1193182
Copy link
Contributor

Motivation and Context

When a stream fails to receive, it can often be difficult to know why. The displayed error message does not make it clear what caused the problem, which can make it more challenging to resolve any underlying issues.

Description

This change adds a separate return code to zfs_ioc_recv that is used for incomplete streams, in addition to the existing return code for streams that contain corruption.

How Has This Been Tested?

Created a send stream, and then two copies. One was truncated by a few kilobytes, and the other had a random byte modified.

delphix@pd-send:~$ cat stream.trunc | sudo zfs recv test/rfs
cannot receive new filesystem stream: incomplete stream
delphix@pd-send:~$ cat stream.cksum | sudo zfs recv test/rfs
cannot receive new filesystem stream: checksum mismatch
delphix@pd-send:~$ cat stream | sudo zfs recv test/rfs
delphix@pd-send:~$

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.

@pcd1193182 pcd1193182 requested a review from behlendorf March 11, 2020 20:32
@pcd1193182 pcd1193182 assigned ahrens and pcd1193182 and unassigned ahrens Mar 11, 2020
@pcd1193182 pcd1193182 requested a review from ahrens March 11, 2020 20:32
@pcd1193182 pcd1193182 added the Status: Code Review Needed Ready for review and testing label Mar 11, 2020
module/zfs/dmu_recv.c Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Mar 12, 2020

Codecov Report

Merging #10122 into master will increase coverage by 29.57%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #10122       +/-   ##
===========================================
+ Coverage   49.72%   79.29%   +29.57%     
===========================================
  Files         324      385       +61     
  Lines       97160   122389    +25229     
===========================================
+ Hits        48309    97053    +48744     
+ Misses      48851    25336    -23515     
Flag Coverage Δ
#kernel 79.67% <100.00%> (+73.35%) ⬆️
#user 66.42% <66.66%> (+8.51%) ⬆️
Impacted Files Coverage Δ
lib/libzfs/libzfs_sendrecv.c 75.72% <100.00%> (ø)
module/zfs/dmu_recv.c 76.20% <100.00%> (+76.20%) ⬆️
module/zfs/space_map.c 93.31% <0.00%> (-2.48%) ⬇️
module/zfs/vdev_initialize.c 97.77% <0.00%> (-0.32%) ⬇️
module/icp/core/kcf_callprov.c 4.55% <0.00%> (-0.21%) ⬇️
module/zfs/lzjb.c 98.14% <0.00%> (ø)
lib/libuutil/uu_list.c 59.64% <0.00%> (ø)
lib/libzfs/os/linux/libzfs_util_os.c 56.92% <0.00%> (ø)
cmd/zinject/zinject.c 35.03% <0.00%> (ø)
cmd/zed/agents/zfs_agents.c 90.66% <0.00%> (ø)
... and 285 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 6187151...218f71a. Read the comment docs.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) Status: Code Review Needed Ready for review and testing and removed Status: Code Review Needed Ready for review and testing Status: Accepted Ready to integrate (reviewed, tested) labels Mar 13, 2020
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Mar 16, 2020
@behlendorf behlendorf merged commit 7145123 into openzfs:master Mar 17, 2020
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
This change adds a separate return code to zfs_ioc_recv that is used 
for incomplete streams, in addition to the existing return code for 
streams that contain corruption.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes openzfs#10122
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.

4 participants