garbage_collection: only ignore 'missing chunk' errors

with the fix for #2909 (improving handling missing chunks), we
changed from bailing to warning during a garbage collection when
updating the atime of a chunk.

but, updating the atime can not only fail when the chunk is missing,
but also on other occasions, e.g. no permissions or more importantly,
no space left on the device. in that case, the atime of a valid and used
chunk cannot be updated, and the second sweep of the gc will remove that chunk.
[0] is a real world example of that happening.

instead, only warn on really missin chunks, and bail on all other
errors.

0: https://forum.proxmox.com/threads/pbs-server-full-two-days-later-almost-empty.83274/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-02-01 09:07:12 +01:00 committed by Dietmar Maurer
parent 9883b54cba
commit 1399c592d1

View File

@ -445,13 +445,12 @@ impl DataStore {
worker.check_abort()?; worker.check_abort()?;
tools::fail_on_shutdown()?; tools::fail_on_shutdown()?;
let digest = index.index_digest(pos).unwrap(); let digest = index.index_digest(pos).unwrap();
if let Err(err) = self.chunk_store.touch_chunk(digest) { if !self.chunk_store.cond_touch_chunk(digest, false)? {
crate::task_warn!( crate::task_warn!(
worker, worker,
"warning: unable to access chunk {}, required by {:?} - {}", "warning: unable to access non-existant chunk {}, required by {:?}",
proxmox::tools::digest_to_hex(digest), proxmox::tools::digest_to_hex(digest),
file_name, file_name,
err,
); );
// touch any corresponding .bad files to keep them around, meaning if a chunk is // touch any corresponding .bad files to keep them around, meaning if a chunk is