]> git.proxmox.com Git - mirror_zfs.git/commitdiff
zfs_receive_one: Check for the more likely error first
authorAllan Jude <allan@klarasystems.com>
Fri, 20 Jan 2023 19:11:54 +0000 (14:11 -0500)
committerGitHub <noreply@github.com>
Fri, 20 Jan 2023 19:11:54 +0000 (11:11 -0800)
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 <behlendorf1@llnl.gov>
Signed-off-by: Allan Jude <allan@klarasystems.com>
Sponsored-by: rsync.net
Sponsored-by: Klara Inc.
Closes #14379

lib/libzfs/libzfs_sendrecv.c

index 7aebd85f8cae029dd3e959676f578a4ab4a5f9c9..49ae7d449b70a8f62110d237cd754beff8eecfdb 100644 (file)
@@ -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;