public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: Fiona Ebner <f.ebner@proxmox.com>
Cc: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup] fix: allow datastore creation in directory with lost+found directory
Date: Wed, 20 Nov 2024 11:51:54 +0100	[thread overview]
Message-ID: <62qdxfi2wjug63bnp3e7qcxh2w4b5tk4u5lzm7lgdvf7nqx57j@iz5m3zy6tpcs> (raw)
In-Reply-To: <9ea533d6-7c5f-41db-9f60-e2a7fc09375b@proxmox.com>

On 20.11.2024 11:19, Fiona Ebner wrote:
>Am 19.11.24 um 17:17 schrieb Gabriel Goller:
>> 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")
>
>Nit: while it shouldn't make much difference in practice, why use
>starts_with()? Exact checking would seem more natural to me for this.

Actually no idea :)

Will submit a v2 with Eq.


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


      reply	other threads:[~2024-11-20 10:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19 16:17 Gabriel Goller
2024-11-20 10:19 ` Fiona Ebner
2024-11-20 10:51   ` Gabriel Goller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=62qdxfi2wjug63bnp3e7qcxh2w4b5tk4u5lzm7lgdvf7nqx57j@iz5m3zy6tpcs \
    --to=g.goller@proxmox.com \
    --cc=f.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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