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 error text for EINVAL in zfs_receive_one() #8977

Merged
merged 1 commit into from
Jul 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/libzfs/libzfs_sendrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -5021,14 +5021,15 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
*cp = '@';
break;
case EINVAL:
if (flags->resumable)
if (flags->resumable) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"kernel modules must be upgraded to "
"receive this stream."));
if (embedded && !raw)
} else if (embedded && !raw) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

encrypted is not the same as raw. encrypted means that the resulting dataset from the receive was encrypted. Raw means that the encrypted dataset was sent using the raw send feature flag. It is confusing, and a guess at best, but this code should be more accurate than what is there now. I have proposed more general fixes for error reporting in cases like this, which I will hopefully get to some time soon.

Copy link
Contributor

Choose a reason for hiding this comment

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

i also found this:

https://github.com/zfsonlinux/zfs/blob/681a85cb01a9f83b9f742d8fb634edddc68c5679/module/zfs/dmu_recv.c#L573-L580

embedded data is incompatible with encryption and raw recv

unless i'm missing something we should theoretically handle EINVAL when both DMU_BACKUP_FEATURE_RAW and DMU_BACKUP_FEATURE_EMBED_DATA are set

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That should never happen. The flags are mutually exclusive on the send side. There are many places where the recv code can return EINVAL that will be misinterpreted. The idea of this patch is not to correct all of these cases, but simply to make this case (that a few people have hit) function as it was originally intended. We will address the broader problem of badly interpreted error codes in another pull request.

zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"incompatible embedded data stream "
"feature with encrypted receive."));
}
(void) zfs_error(hdl, EZFS_BADSTREAM, errbuf);
break;
case ECKSUM:
Expand Down