Make invalid handles permanent errors

This commit is contained in:
greatroar
2020-12-17 12:47:53 +01:00
parent 746dbda413
commit 66d904c905
8 changed files with 32 additions and 26 deletions

View File

@@ -264,7 +264,7 @@ func (r *SFTP) Save(ctx context.Context, h restic.Handle, rd restic.RewindReader
}
if err := h.Valid(); err != nil {
return err
return backoff.Permanent(err)
}
filename := r.Filename(h)
@@ -311,7 +311,7 @@ func (r *SFTP) Load(ctx context.Context, h restic.Handle, length int, offset int
func (r *SFTP) openReader(ctx context.Context, h restic.Handle, length int, offset int64) (io.ReadCloser, error) {
debug.Log("Load %v, length %v, offset %v", h, length, offset)
if err := h.Valid(); err != nil {
return nil, err
return nil, backoff.Permanent(err)
}
if offset < 0 {
@@ -346,7 +346,7 @@ func (r *SFTP) Stat(ctx context.Context, h restic.Handle) (restic.FileInfo, erro
}
if err := h.Valid(); err != nil {
return restic.FileInfo{}, err
return restic.FileInfo{}, backoff.Permanent(err)
}
fi, err := r.c.Lstat(r.Filename(h))