public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup 1/2] tape/file_formats/blocked_reader: restore EOD behaviour
@ 2021-04-09 14:18 Dominik Csapak
  2021-04-09 14:18 ` [pbs-devel] [PATCH proxmox-backup 2/2] api2/tape/backup: commit pool even after an error Dominik Csapak
  0 siblings, 1 reply; 3+ messages in thread
From: Dominik Csapak @ 2021-04-09 14:18 UTC (permalink / raw)
  To: pbs-devel

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@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





^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re: [pbs-devel] [PATCH proxmox-backup 1/2] tape/file_formats/blocked_reader: restore EOD behaviour
@ 2021-04-09 15:54 Dietmar Maurer
  0 siblings, 0 replies; 3+ messages in thread
From: Dietmar Maurer @ 2021-04-09 15:54 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

IMHO this is the wrong fix.

Instead, we want to catch ENOSPC.

> On 04/09/2021 4:18 PM Dominik Csapak <d.csapak@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@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@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-09 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 14:18 [pbs-devel] [PATCH proxmox-backup 1/2] tape/file_formats/blocked_reader: restore EOD behaviour Dominik Csapak
2021-04-09 14:18 ` [pbs-devel] [PATCH proxmox-backup 2/2] api2/tape/backup: commit pool even after an error Dominik Csapak
2021-04-09 15:54 [pbs-devel] [PATCH proxmox-backup 1/2] tape/file_formats/blocked_reader: restore EOD behaviour Dietmar Maurer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal