HomeFreeBSD

Fix error handling in receive_writer_thread()

Description

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 <behlendorf1@llnl.gov>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
Closes #10320

Details

Provenance
mahrensAuthored on May 15 2020, 3:48 AM
GitHub <noreply@github.com>Committed on May 15 2020, 3:48 AM
Parents
rGcdcce2f0190e: Fix VN_OPEN_INVFS typo
Branches
Unknown
Tags
Unknown