[pbs-devel] [PATCH proxmox-backup v6 3/6] pbs-datastore: add active operations tracking
Dominik Csapak
d.csapak at proxmox.com
Thu Feb 3 11:53:32 CET 2022
[..snip..]
On 2/2/22 16:49, Hannes Laimer wrote:
> +impl Clone for DataStore {
> + fn clone(&self) -> Self {
> + if let Some(operation) = self.operation.clone() {
> + if let Err(e) = update_active_operations(self.name(), operation, -1) {
this must have '1' instead of '-1' else a lookup + clone makes it look like
no operation is running and dropping both, leaves the counter at -2
> + eprintln!("could not update active operations - {}", e);
> + }
> + }
> + DataStore {
> + inner: self.inner.clone(),
> + operation: self.operation.clone(),
> + }
> + }
> +}
> +
> +impl Drop for DataStore {
> + fn drop(&mut self) {
> + if let Some(operation) = self.operation.clone() {
> + if let Err(e) = update_active_operations(self.name(), operation, -1) {
> + eprintln!("could not update active operations - {}", e);
> + }
> + }
> + }
> +}
> +
[..snip..]
More information about the pbs-devel
mailing list