[pbs-devel] applied: [PATCH proxmox-backup] tools/process_locker: Decrement writer count in drop handler

Dietmar Maurer dietmar at proxmox.com
Fri Dec 18 07:15:34 CET 2020


applied

> On 12/17/2020 3:33 PM Dominik Csapak <d.csapak at proxmox.com> wrote:
> 
>  
> of ProcessLockSharedGuard.
> 
> We use a counter to determine if we can unlock the file again, but
> we never actually decremented the writer count, so we held the
> lock forever.
> 
> This fixes the issue that we could not start a garbage collect after
> a reload, as long as the old process is still running, even when that
> process has no active backup anymore but another long running task
> (e.g. file download, terminal, etc.).
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  src/tools/process_locker.rs | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/tools/process_locker.rs b/src/tools/process_locker.rs
> index 56f8c514..6ab2e1c1 100644
> --- a/src/tools/process_locker.rs
> +++ b/src/tools/process_locker.rs
> @@ -55,7 +55,9 @@ impl  Drop for ProcessLockSharedGuard {
>              if let Err(err) = nix::fcntl::fcntl(data.file.as_raw_fd(), nix::fcntl::FcntlArg::F_SETLKW(&op)) {
>                  panic!("unable to drop writer lock - {}", err);
>              }
> -            data.writers = 0;
> +        }
> +        if data.writers > 0 {
> +            data.writers -= 1;
>          }
>      }
>  }
> -- 
> 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