From 63267f7f77b0205bab435822c5df629d1018ad69 Mon Sep 17 00:00:00 2001 From: Allan Jude Date: Fri, 20 Jan 2023 14:11:54 -0500 Subject: [PATCH] zfs_receive_one: Check for the more likely error first If zfs_receive_one() gets back EINVAL, check for the more likely case, embedded block pointers + encryption and return that error, before falling back to the less likely case, a resumable stream when the kernel has not been upgraded to support resume. Reviewed-by: Brian Behlendorf Signed-off-by: Allan Jude Sponsored-by: rsync.net Sponsored-by: Klara Inc. Closes #14379 --- lib/libzfs/libzfs_sendrecv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 7aebd85f8c..49ae7d449b 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -5117,14 +5117,14 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, *cp = '@'; break; case EINVAL: - if (flags->resumable) { - zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "kernel modules must be upgraded to " - "receive this stream.")); - } else if (embedded && !raw) { + if (embedded && !raw) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "incompatible embedded data stream " "feature with encrypted receive.")); + } else if (flags->resumable) { + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "kernel modules must be upgraded to " + "receive this stream.")); } (void) zfs_error(hdl, EZFS_BADSTREAM, errbuf); break;