[pbs-devel] [PATCH proxmox-backup] pxar/create: handle ErrorKind::Interrupted for file reads

Dominik Csapak d.csapak at proxmox.com
Thu Nov 5 09:29:06 CET 2020


they are not an error and we should retry the read

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/pxar/create.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/pxar/create.rs b/src/pxar/create.rs
index f4c735d0..6fe820bd 100644
--- a/src/pxar/create.rs
+++ b/src/pxar/create.rs
@@ -657,7 +657,11 @@ impl<'a, 'b> Archiver<'a, 'b> {
         let mut remaining = file_size;
         let mut out = encoder.create_file(metadata, file_name, file_size)?;
         while remaining != 0 {
-            let mut got = file.read(&mut self.file_copy_buffer[..])?;
+            let mut got = match file.read(&mut self.file_copy_buffer[..]) {
+                Ok(got) => got,
+                Err(err) if err.kind() == std::io::ErrorKind::Interrupted => continue,
+                Err(err) => bail!(err),
+            };
             if got as u64 > remaining {
                 self.report_file_grew_while_reading()?;
                 got = remaining as usize;
-- 
2.20.1






More information about the pbs-devel mailing list