From c63b47e4dac9ee05ed8f3803f783c5c9ee3d44bb Mon Sep 17 00:00:00 2001 From: Ameer Hamza Date: Fri, 3 Feb 2023 04:09:57 +0500 Subject: [PATCH] Fix console progress reporting for recursive send After commit 19d3961, progress reporting (-v) with replication flag enabled does not report the progress on the console. This commit fixes the issue by updating the logic to check for pa->progress instead of pa_verbosity in send_progress_thread(). Reviewed-by: Brian Behlendorf Reviewed-by: Ryan Moeller Signed-off-by: Ameer Hamza Closes #14448 --- cmd/zfs/zfs_main.c | 2 +- lib/libzfs/libzfs_sendrecv.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 7e77c865d4..ff6510e440 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -4565,7 +4565,7 @@ zfs_do_send(int argc, char **argv) } } - if (flags.parsable && flags.verbosity == 0) + if ((flags.parsable || flags.progressastitle) && flags.verbosity == 0) flags.verbosity = 1; argc -= optind; diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 439d20a7a3..8f496b20b8 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -84,6 +84,7 @@ typedef struct progress_arg { boolean_t pa_estimate; int pa_verbosity; boolean_t pa_astitle; + boolean_t pa_progress; uint64_t pa_size; } progress_arg_t; @@ -926,7 +927,7 @@ send_progress_thread(void *arg) return ((void *)(uintptr_t)err); } - if (firstloop && !pa->pa_parsable && pa->pa_verbosity != 0) { + if (firstloop && !pa->pa_parsable && pa->pa_progress) { (void) fprintf(stderr, "TIME %s %sSNAPSHOT %s\n", pa->pa_estimate ? "BYTES" : " SENT", @@ -965,7 +966,7 @@ send_progress_thread(void *arg) (void) fprintf(stderr, "%02d:%02d:%02d\t%llu\t%s\n", tm->tm_hour, tm->tm_min, tm->tm_sec, (u_longlong_t)bytes, zhp->zfs_name); - } else if (pa->pa_verbosity != 0) { + } else if (pa->pa_progress) { zfs_nicebytes(bytes, buf, sizeof (buf)); (void) fprintf(stderr, "%02d:%02d:%02d %5s %s\n", tm->tm_hour, tm->tm_min, tm->tm_sec, @@ -1137,6 +1138,7 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) pa.pa_verbosity = sdd->verbosity; pa.pa_size = sdd->size; pa.pa_astitle = sdd->progressastitle; + pa.pa_progress = sdd->progress; if ((err = pthread_create(&tid, NULL, send_progress_thread, &pa)) != 0) { @@ -1788,6 +1790,7 @@ zfs_send_resume_impl(libzfs_handle_t *hdl, sendflags_t *flags, int outfd, pa.pa_verbosity = flags->verbosity; pa.pa_size = size; pa.pa_astitle = flags->progressastitle; + pa.pa_progress = flags->progress; error = pthread_create(&tid, NULL, send_progress_thread, &pa); @@ -2541,6 +2544,7 @@ zfs_send_one(zfs_handle_t *zhp, const char *from, int fd, sendflags_t *flags, pa.pa_verbosity = flags->verbosity; pa.pa_size = size; pa.pa_astitle = flags->progressastitle; + pa.pa_progress = flags->progress; err = pthread_create(&ptid, NULL, send_progress_thread, &pa);