* [pbs-devel] [PATCH proxmox-backup] datastore: cleanup newly created group dir if setting owner failed
@ 2025-08-06 10:51 Christian Ebner
2025-08-11 11:52 ` [pbs-devel] applied: " Fabian Grünbichler
0 siblings, 1 reply; 2+ messages in thread
From: Christian Ebner @ 2025-08-06 10:51 UTC (permalink / raw)
To: pbs-devel
Setting the owner might fail for various reasons, e.g. the user might
run out of space or the upload to the backend might fail in case of
datastores backed by s3. Currently, this would result in the newly
created but still empty group directory to be left behind, no owner
file being present. That will however cause issues as the owner check
is performed if the group folder is present, expecting the owner file
to be present.
To fix this, simply clean up the newly created backup group directory
in case setting the owner failed.
Reported-by: Daniel Kral <d.kral@proxmox.com>
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
pbs-datastore/src/datastore.rs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index f039bd9a9..7cf020fc0 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -1008,7 +1008,10 @@ impl DataStore {
let guard = backup_group.lock().with_context(|| {
format!("while creating new locked backup group '{backup_group:?}'")
})?;
- self.set_owner(ns, backup_group.group(), auth_id, false)?;
+ if let Err(err) = self.set_owner(ns, backup_group.group(), auth_id, false) {
+ let _ = std::fs::remove_dir(&full_path);
+ return Err(err);
+ }
let owner = self.get_owner(ns, backup_group.group())?; // just to be sure
Ok((owner, guard))
}
--
2.47.2
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pbs-devel] applied: [PATCH proxmox-backup] datastore: cleanup newly created group dir if setting owner failed
2025-08-06 10:51 [pbs-devel] [PATCH proxmox-backup] datastore: cleanup newly created group dir if setting owner failed Christian Ebner
@ 2025-08-11 11:52 ` Fabian Grünbichler
0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2025-08-11 11:52 UTC (permalink / raw)
To: pbs-devel, Christian Ebner
On Wed, 06 Aug 2025 12:51:28 +0200, Christian Ebner wrote:
> Setting the owner might fail for various reasons, e.g. the user might
> run out of space or the upload to the backend might fail in case of
> datastores backed by s3. Currently, this would result in the newly
> created but still empty group directory to be left behind, no owner
> file being present. That will however cause issues as the owner check
> is performed if the group folder is present, expecting the owner file
> to be present.
>
> [...]
Applied, thanks!
[1/1] datastore: cleanup newly created group dir if setting owner failed
commit: fe03ada8f1259e2e38c3a96c23b63fe82159e06a
Best regards,
--
Fabian Grünbichler <f.gruenbichler@proxmox.com>
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-11 11:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-06 10:51 [pbs-devel] [PATCH proxmox-backup] datastore: cleanup newly created group dir if setting owner failed Christian Ebner
2025-08-11 11:52 ` [pbs-devel] applied: " Fabian Grünbichler
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.