zstream: add a drop_record subcommand#18275
Open
asomers wants to merge 1 commit intoopenzfs:masterfrom
Open
Conversation
It can be used to drop extraneous records in a send stream caused by a corrupt dataset, as in issue openzfs#18239 . Signed-off-by: Alan Somers <asomers@gmail.com> Sponsored by: ConnectWise
behlendorf
reviewed
Mar 6, 2026
Contributor
behlendorf
left a comment
There was a problem hiding this comment.
Let's add a basic test case for which drops a record and verifies the stream can still be received. There are two existing zstream tests in tests/zfs-tests/tests/functional/rsend/, send-c_zstreamdump.ksh and send-c_zstream_recompress.ksh whch can be used as examples.
Aside from that this change makes good sense to me, and I can see it being handy when you need it.
| return (errno); | ||
| } | ||
| return (0); | ||
| } |
Contributor
There was a problem hiding this comment.
If you rebase this on master we can avoid adding yet another copy of dump_record(). I've merged #18284 which adds zstream_util.[ch] to provide some shared utility functions, including dump_record().
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
It can be used to drop extraneous records in a send stream caused by a corrupt dataset, as in issue #18239 .
Signed-off-by: Alan Somers asomers@gmail.com
Sponsored by: ConnectWise
Motivation and Context
Issue #18239 can cause corrupted files which can still be read or written to, but cannot be received by
zfs recv. This change adds a feature tozstreamthat can filter out the offending records from a stream, allowing the dataset to be migrated with send/recv .Description
Add a
zstream drop_recordsubcommand. It can be used to drop one or more records from an object in a send stream. So far, all of the only corruption I know of caused by this issue happens at file offset 0xffffffffffff0000, but thedrop_recordsubcommand accepts a record at any offset, so it's use is more general.How Has This Been Tested?
This new feature was used to successfully migrate a production dataset that had four identically-corrupted objects.
Types of changes
Checklist:
Signed-off-by.