[pbs-devel] [PATCH proxmox-backup 1/2] tape: changer: sg_pt: do not retry on unknown errors

Dominik Csapak d.csapak at proxmox.com
Mon Jul 12 12:22:08 CEST 2021


we handle some special errors, but want to return all others, so do that

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/tape/changer/sg_pt_changer.rs | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/tape/changer/sg_pt_changer.rs b/src/tape/changer/sg_pt_changer.rs
index 31c38576..29b04ad6 100644
--- a/src/tape/changer/sg_pt_changer.rs
+++ b/src/tape/changer/sg_pt_changer.rs
@@ -100,10 +100,8 @@ fn execute_scsi_command<F: AsRawFd>(
     loop {
         match sg_raw.do_command(&cmd) {
             Ok(data) => return Ok(data.to_vec()),
+            Err(err) if !retry => bail!("{} failed: {}", error_prefix, err),
             Err(err) => {
-                if !retry {
-                    bail!("{} failed: {}", error_prefix, err);
-                }
                 if let ScsiError::Sense(ref sense) = err {
 
                     if sense.sense_key == SENSE_KEY_NO_SENSE ||
@@ -136,6 +134,7 @@ fn execute_scsi_command<F: AsRawFd>(
                         continue; // try again
                     }
                 }
+                bail!("{} failed: {}", error_prefix, err);
             }
         }
    }
-- 
2.30.2






More information about the pbs-devel mailing list