public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] fix: allow datastore creation in directory with lost+found directory
@ 2024-11-19 16:17 Gabriel Goller
  2024-11-20 10:19 ` Fiona Ebner
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriel Goller @ 2024-11-19 16:17 UTC (permalink / raw)
  To: pbs-devel

When creating a datastore without the "reuse-datastore" option and the
datastore contains a `lost+found` directory (which is quite common), the
creation fails. Add `lost+found` to the ignore list.

Reported here: https://forum.proxmox.com/threads/bug-when-adding-new-storage-task-error-datastore-path-is-not-empty.157629/#post-721733

Fixes: 6e101ff75777 ("fix #5439: allow to reuse existing datastore")
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/api2/config/datastore.rs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs
index 374c302fcf28..f3bf652cda76 100644
--- a/src/api2/config/datastore.rs
+++ b/src/api2/config/datastore.rs
@@ -89,7 +89,9 @@ pub(crate) fn do_create_datastore(
         if let Ok(dir) = std::fs::read_dir(&path) {
             for file in dir {
                 let name = file?.file_name();
-                if !name.to_str().map_or(false, |name| name.starts_with('.')) {
+                if !name.to_str().map_or(false, |name| {
+                    name.starts_with('.') || name.starts_with("lost+found")
+                }) {
                     bail!("datastore path is not empty");
                 }
             }
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-20 10:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-19 16:17 [pbs-devel] [PATCH proxmox-backup] fix: allow datastore creation in directory with lost+found directory Gabriel Goller
2024-11-20 10:19 ` Fiona Ebner
2024-11-20 10:51   ` Gabriel Goller

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