public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Reiter <s.reiter@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v2 proxmox-backup 5/5] backup: touch all chunks, even if they exist
Date: Mon,  7 Sep 2020 17:30:36 +0200	[thread overview]
Message-ID: <20200907153036.9324-6-s.reiter@proxmox.com> (raw)
In-Reply-To: <20200907153036.9324-1-s.reiter@proxmox.com>

We need to update the atime of chunk files if they already exist,
otherwise a concurrently running GC could sweep them away.

This is protected with ChunkStore.mutex, so the fstat/unlink does not
race with touching.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---

New in v2.

 src/backup/chunk_store.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/backup/chunk_store.rs b/src/backup/chunk_store.rs
index abe1d67f..1d9de70a 100644
--- a/src/backup/chunk_store.rs
+++ b/src/backup/chunk_store.rs
@@ -414,6 +414,7 @@ impl ChunkStore {
 
         if let Ok(metadata) = std::fs::metadata(&chunk_path) {
             if metadata.is_file() {
+                self.touch_chunk(digest)?;
                 return Ok((true, metadata.len()));
             } else {
                 bail!("Got unexpected file type on store '{}' for chunk {}", self.name, digest_str);
-- 
2.20.1





  parent reply	other threads:[~2020-09-07 15:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-07 15:30 [pbs-devel] [PATCH v2 0/5] Improve corrupt chunk handling Stefan Reiter
2020-09-07 15:30 ` [pbs-devel] [PATCH v2 proxmox-backup 1/5] verify: fix log units Stefan Reiter
2020-09-07 15:30 ` [pbs-devel] [PATCH v2 proxmox-backup 2/5] verify: rename corrupted chunks with .bad extension Stefan Reiter
2020-09-08 10:27   ` Dietmar Maurer
2020-09-07 15:30 ` [pbs-devel] [PATCH v2 proxmox-backup 3/5] gc: remove .bad files on garbage collect Stefan Reiter
2020-09-07 15:30 ` [pbs-devel] [PATCH v2 proxmox-backup 4/5] backup: check all referenced chunks actually exist Stefan Reiter
2020-09-08 10:49   ` Dietmar Maurer
2020-09-07 15:30 ` Stefan Reiter [this message]
2020-09-08 10:51 ` [pbs-devel] [PATCH v2 0/5] Improve corrupt chunk handling 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=20200907153036.9324-6-s.reiter@proxmox.com \
    --to=s.reiter@proxmox.com \
    --cc=pbs-devel@lists.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