[pbs-devel] [PATCH proxmox-backup 1/2] tape/file_formats/blocked_reader: restore EOD behaviour

Dietmar Maurer dietmar at proxmox.com
Fri Apr 9 17:54:37 CEST 2021


IMHO this is the wrong fix.

Instead, we want to catch ENOSPC.

> On 04/09/2021 4:18 PM Dominik Csapak <d.csapak at proxmox.com> wrote:
> 
>  
> before commit
> 0db571249 ("tape: introduce BlockRead")
> 
> we did not return an error on EOD, but changed that.
> The rest of the code assumes to be able to read there and not
> encounter an error, so that change resulted in
> 
> 'no space left on device' errors on all tasks/api calls where we
> would read to the end of the tape, e.g. a restore, read label on an
> empty tape, etc.
> 
> This patch restores the previous behaviour.
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> not sure if this is the intended behavior, but fixes many
> 'no space on device' errors we encounter currently
> 
> if the intention was that we catch the enospc error explicitely on the
> caller side, we would have to invent our own error type here,
> as this results in an io::Error with ErrorKind::Other (makes matching a bit weird)
> 
>  src/tape/file_formats/blocked_reader.rs | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/src/tape/file_formats/blocked_reader.rs b/src/tape/file_formats/blocked_reader.rs
> index 3df84a1b..e7dfa90a 100644
> --- a/src/tape/file_formats/blocked_reader.rs
> +++ b/src/tape/file_formats/blocked_reader.rs
> @@ -111,12 +111,9 @@ impl <R: BlockRead> BlockedReader<R> {
>                  }
>                  Ok(true)
>              }
> -            Ok(BlockReadStatus::EndOfFile) => {
> +            Ok(BlockReadStatus::EndOfFile) | Ok(BlockReadStatus::EndOfStream)=> {
>                  Ok(false)
>              }
> -            Ok(BlockReadStatus::EndOfStream) => {
> -                return Err(std::io::Error::from_raw_os_error(nix::errno::Errno::ENOSPC as i32));
> -            }
>              Err(err) => {
>                  Err(err)
>              }
> -- 
> 2.20.1
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel





More information about the pbs-devel mailing list