From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Stefan Reiter <s.reiter@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] applied: [PATCH proxmox-backup] async_lru_cache: fix handling of errors in fetch
Date: Mon, 28 Jun 2021 13:52:36 +0200 [thread overview]
Message-ID: <20210628115236.wb5sv7edbe35se23@olga.proxmox.com> (raw)
In-Reply-To: <20210617090232.3615250-1-s.reiter@proxmox.com>
applied
On Thu, Jun 17, 2021 at 11:02:32AM +0200, Stefan Reiter wrote:
> The future needs to be removed from the pending map in any case, even if
> it returned an error, else all upcoming calls to access this key will
> always return the same error.
>
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
>
> I don't think this can happen at the moment, as we only use this in parts of the
> code were one returned error already causes an abort, but should still be fixed.
>
> src/tools/async_lru_cache.rs | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/src/tools/async_lru_cache.rs b/src/tools/async_lru_cache.rs
> index cc385ec9..62e74fcd 100644
> --- a/src/tools/async_lru_cache.rs
> +++ b/src/tools/async_lru_cache.rs
> @@ -65,15 +65,16 @@ impl<K: std::cmp::Eq + std::hash::Hash + Copy, V: Clone + Send + 'static> AsyncL
> };
>
> let result = result_fut.await;
> - match result {
> - Ok(Some(ref value)) if owner => {
> - // this call was the one initiating the request, put into LRU and remove from map
> - let mut maps = self.maps.lock().unwrap();
> +
> + if owner {
> + // this call was the one initiating the request, put into LRU and remove from map
> + let mut maps = self.maps.lock().unwrap();
> + if let Ok(Some(ref value)) = result {
> maps.0.insert(key, value.clone());
> - maps.1.remove(&key);
> }
> - _ => {}
> + maps.1.remove(&key);
> }
> +
> result
> }
> }
> --
> 2.30.2
prev parent reply other threads:[~2021-06-28 11:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-17 9:02 [pbs-devel] " Stefan Reiter
2021-06-28 11:52 ` Wolfgang Bumiller [this message]
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=20210628115236.wb5sv7edbe35se23@olga.proxmox.com \
--to=w.bumiller@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