diff options
author | Matthew Ahrens <[email protected]> | 2020-05-14 20:48:29 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-14 20:48:29 -0700 |
commit | 1b9cd1a9d9ebd213df1427d38e75d3233c873bde (patch) | |
tree | 07a22ce7c2dda55048fe60a14153e56cfab5eaf7 | |
parent | cdcce2f0190e05127d304fcc261cfdb5284ab621 (diff) |
Fix error handling in receive_writer_thread()
If `receive_writer_thread()` gets an error from `receive_process_record()`,
it should be saved in `rwa->err` so that we will stop processing records,
and the main thread will notice that the receive has failed.
When an error is first encountered, this happens correctly. However, if
there are more records to dequeue, the next time through the loop we
will reset `rwa->err` to zero, allowing us to try to process the
following record (2 after the failed record). Depending on what types
of records remain, we may incorrectly complete the receive
"successfully", but without actually having processed all the records.
The fix is to only set `rwa->err` if we got a *non-zero* error.
This bug was introduced by #10099 "Improve zfs receive performance by
batching writes".
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Paul Dagnelie <[email protected]>
Signed-off-by: Matthew Ahrens <[email protected]>
Closes #10320
-rw-r--r-- | module/zfs/dmu_recv.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/module/zfs/dmu_recv.c b/module/zfs/dmu_recv.c index ed52b25e6..29fbe854d 100644 --- a/module/zfs/dmu_recv.c +++ b/module/zfs/dmu_recv.c @@ -2572,7 +2572,8 @@ receive_writer_thread(void *arg) * free it. */ if (err != EAGAIN) { - rwa->err = err; + if (rwa->err == 0) + rwa->err = err; kmem_free(rrd, sizeof (*rrd)); } } |