public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dietmar Maurer <dietmar@proxmox.com>
To: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>,
	 Stefan Reiter <s.reiter@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup 4/5] backup: use flock on backup group to forbid multiple backups at once
Date: Thu, 30 Jul 2020 07:50:53 +0200 (CEST)	[thread overview]
Message-ID: <1200038958.55.1596088254348@webmail.proxmox.com> (raw)
In-Reply-To: <20200729123314.10049-5-s.reiter@proxmox.com>

> +        // acquire in non-blocking mode, no point in waiting here since other
> +        // backups could still take a very long time
> +        tools::lock_file(&mut handle, true, Some(Duration::from_nanos(0)))
> +            .map_err(|err| {
> +                match err.downcast_ref::<nix::Error>() {
> +                    Some(nix::Error::Sys(nix::errno::Errno::EAGAIN)) => {

Honestly, I would remove this special case with downcast - the default error message is good enough. Isn't it?

> +                        return format_err!(
> +                            "unable to acquire lock on backup group {:?} - another backup is already running",
> +                            self.group_path(),
> +                        );
> +                    },
> +                    _ => ()
> +                }
> +                format_err!(
> +                    "unable to acquire lock on backup group {:?} - {}",
> +                    self.group_path(),
> +                    err,
> +                )
> +            })?;
> +
> +        Ok(handle)
> +    }
> +




  reply	other threads:[~2020-07-30  5:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29 12:33 [pbs-devel] [PATCH 0/5] fix #2881: protect base snapshots and avoid races Stefan Reiter
2020-07-29 12:33 ` [pbs-devel] [PATCH proxmox-backup 1/5] fix typo: avgerage to average Stefan Reiter
2020-07-30  5:25   ` [pbs-devel] applied: " Dietmar Maurer
2020-07-29 12:33 ` [pbs-devel] [PATCH proxmox-backup 2/5] datastore: prevent deletion of snaps in use as "previous backup" Stefan Reiter
2020-07-30  6:37   ` [pbs-devel] applied: " Dietmar Maurer
2020-07-30  6:40   ` [pbs-devel] " Fabian Grünbichler
2020-07-29 12:33 ` [pbs-devel] [PATCH proxmox-backup 3/5] tools: add nonblocking mode to lock_file Stefan Reiter
2020-07-30  6:23   ` [pbs-devel] applied: " Dietmar Maurer
2020-07-29 12:33 ` [pbs-devel] [PATCH proxmox-backup 4/5] backup: use flock on backup group to forbid multiple backups at once Stefan Reiter
2020-07-30  5:50   ` Dietmar Maurer [this message]
2020-07-30  7:36     ` Stefan Reiter
2020-07-30  7:41       ` Dietmar Maurer
2020-07-30  8:02         ` Stefan Reiter
2020-07-30  6:38   ` [pbs-devel] applied: " Dietmar Maurer
2020-07-29 12:33 ` [pbs-devel] [PATCH proxmox-backup 5/5] backup: ensure base snapshots are still available after backup Stefan Reiter
2020-07-30  6:38   ` [pbs-devel] applied: " Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1200038958.55.1596088254348@webmail.proxmox.com \
    --to=dietmar@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=s.reiter@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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