[pbs-devel] applied: [PATCH proxmox-backup v2] fix: allow datastore creation in directory with lost+found directory

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Nov 22 09:08:01 CET 2024


with a slight style change by pulling out the `to_str()` into its own line, to
reduce the total number of lines ;)

Quoting Gabriel Goller (2024-11-20 11:55:05)
> 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 at proxmox.com>
> ---
> 
> v2, thanks @Fiona:
>  - exact match with == instead of `.starts_with`
> 
>  src/api2/config/datastore.rs | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs
> index 374c302fcf28..9c36cb312a99 100644
> --- a/src/api2/config/datastore.rs
> +++ b/src/api2/config/datastore.rs
> @@ -89,7 +89,10 @@ 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 == "lost+found")
> +                {
>                      bail!("datastore path is not empty");
>                  }
>              }
> -- 
> 2.39.5
> 
> 
> 
> _______________________________________________
> 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