From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 9C77A6627F for ; Thu, 5 Nov 2020 13:46:08 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8FBCA185B5 for ; Thu, 5 Nov 2020 13:46:08 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 20635185A8 for ; Thu, 5 Nov 2020 13:46:08 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id DA7E045A58 for ; Thu, 5 Nov 2020 13:46:07 +0100 (CET) To: pbs-devel@lists.proxmox.com References: <20201104115510.26951-1-f.ebner@proxmox.com> From: Fabian Ebner Message-ID: Date: Thu, 5 Nov 2020 13:45:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201104115510.26951-1-f.ebner@proxmox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.029 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -0.001 Looks like a legit reply (A) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [directory.rs] Subject: Re: [pbs-devel] [PATCH proxmox-backup] don't overwrite existing systemd mount unit X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 12:46:08 -0000 It might make more sense to check in create_datastore_disk whether the actual mount point exists and bail out before partitioning. That is similar to what we do for zfs and has the advantage that disks will still be considered unused after a failed creation attempt. This patch could still be used in addition to that, but it's probably not worth it then. Am 04.11.20 um 12:55 schrieb Fabian Ebner: > Signed-off-by: Fabian Ebner > --- > src/api2/node/disks/directory.rs | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs > index 2a4780f2..c650b887 100644 > --- a/src/api2/node/disks/directory.rs > +++ b/src/api2/node/disks/directory.rs > @@ -252,6 +252,11 @@ fn create_datastore_mount_unit( > mount_unit_name.push_str(".mount"); > > let mount_unit_path = format!("/etc/systemd/system/{}", mount_unit_name); > + let full_path = std::path::Path::new(&mount_unit_path); > + > + if full_path.exists() { > + bail!("mount unit {} already exists!", mount_unit_path); > + } > > let unit = SystemdUnitSection { > Description: format!("Mount datatstore '{}' under '{}'", datastore_name, mount_point), >