[pbs-devel] [PATCH proxmox-backup 4/6] datastore: acquire chunk store mutex lock when renaming corrupt chunk

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Oct 27 11:59:31 CET 2025


On October 16, 2025 3:18 pm, Christian Ebner wrote:
> While the rename itself is an atomic operation, it must be assured
> that no other task such as garbage collection or backup chunk insert
> are expecting to hold an exclusive access to the chunk store.
> 
> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
> ---
>  pbs-datastore/src/datastore.rs | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
> index c280b82c7..a7ea8fd96 100644
> --- a/pbs-datastore/src/datastore.rs
> +++ b/pbs-datastore/src/datastore.rs
> @@ -2465,6 +2465,8 @@ impl DataStore {
>              )?;
>          }
>  
> +        let _lock = self.inner.chunk_store.mutex().lock().unwrap();
> +

the counter/new_path loop should move here to also be protected by the
lock - it doesn't buy as much, but it's better than nothing..

but it's also used for S3, without anything ensuring that the counters
are actually in sync between those two?

>          match std::fs::rename(&path, &new_path) {
>              Ok(_) => Ok(Some(format!("corrupted chunk renamed to {new_path:?}"))),
>              Err(err) if err.kind() == std::io::ErrorKind::NotFound => Ok(None),
> -- 
> 2.47.3
> 
> 
> 
> _______________________________________________
> 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