From 1e2e1e486697ae79a3db6ce48a1176540cf83775 Mon Sep 17 00:00:00 2001 From: Paul Dagnelie Date: Wed, 11 Mar 2020 12:20:26 -0700 Subject: [PATCH] Separate warning for incomplete and corrupt streams Signed-off-by: Paul Dagnelie --- lib/libzfs/libzfs_sendrecv.c | 10 ++++++---- module/zfs/dmu_recv.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 3dc7b0705c4f..af1df56247d2 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -4252,12 +4252,12 @@ recv_skip(libzfs_handle_t *hdl, int fd, boolean_t byteswap) static void recv_ecksum_set_aux(libzfs_handle_t *hdl, const char *target_snap, - boolean_t resumable) + boolean_t resumable, boolean_t checksum) { char target_fs[ZFS_MAX_DATASET_NAME_LEN]; - zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "checksum mismatch or incomplete stream")); + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, (checksum ? + "checksum mismatch" : "incomplete stream"))); if (!resumable) return; @@ -5204,7 +5204,9 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, (void) zfs_error(hdl, EZFS_BADSTREAM, errbuf); break; case ECKSUM: - recv_ecksum_set_aux(hdl, destsnap, flags->resumable); + case EPIPE: + recv_ecksum_set_aux(hdl, destsnap, flags->resumable, + ioctl_err == ECKSUM); (void) zfs_error(hdl, EZFS_BADSTREAM, errbuf); break; case ENOTSUP: diff --git a/module/zfs/dmu_recv.c b/module/zfs/dmu_recv.c index 97a3c7ceed97..ae16f4a10270 100644 --- a/module/zfs/dmu_recv.c +++ b/module/zfs/dmu_recv.c @@ -1259,10 +1259,10 @@ receive_read(dmu_recv_cookie_t *drc, int len, void *buf) len - done, &resid); if (resid == len - done) { /* - * Note: ECKSUM indicates that the receive + * Note: ECKSUM or EPIPE indicates that the receive * was interrupted and can potentially be resumed. */ - drc->drc_err = SET_ERROR(ECKSUM); + drc->drc_err = SET_ERROR(EPIPE); } drc->drc_voff += len - done - resid; done = len - resid;