From: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage v4 2/4] Adapted unlink calls for archive files in case of ENOENT
Date: Tue, 14 Jun 2022 11:00:11 +0200 [thread overview]
Message-ID: <20220614090013.84500-2-d.tschlatscher@proxmox.com> (raw)
In-Reply-To: <20220614090013.84500-1-d.tschlatscher@proxmox.com>
This improves handling when two archive remove calls are creating a
race condition where one would formerly encounter an error. Now both
finish successfully.
Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
---
Changes from v3
* No fix #xxxx in commit title
PVE/Storage.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 70dd663..97ea64e 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -1586,7 +1586,7 @@ sub archive_remove {
die "cannot remove protected archive '$archive_path'\n"
if -e protection_file_path($archive_path);
- unlink $archive_path or die "removing archive $archive_path failed: $!\n";
+ unlink $archive_path or $! == ENOENT or die "removing archive $archive_path failed: $!\n";
archive_auxiliaries_remove($archive_path);
}
@@ -1602,7 +1602,7 @@ sub archive_auxiliaries_remove {
my $path = "$dirname/$filename";
if (-e $path) {
- unlink $path or warn "Removing $type file failed: $!\n";
+ unlink $path or $! == ENOENT or warn "Removing $type file failed: $!\n";
}
}
}
--
2.30.2
next prev parent reply other threads:[~2022-06-14 9:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-14 9:00 [pve-devel] [PATCH storage v4 1/4] fix #3972: Remove the .notes file when a backup is deleted Daniel Tschlatscher
2022-06-14 9:00 ` Daniel Tschlatscher [this message]
2022-06-14 9:00 ` [pve-devel] [PATCH storage v4 3/4] Switched to using log_warn of PVE::RESTEnvironment Daniel Tschlatscher
2022-06-14 9:00 ` [pve-devel] [PATCH storage v4 4/4] Added a LOG_EXT constant as a counterpart to NOTES_EXT Daniel Tschlatscher
2022-06-15 8:52 ` [pve-devel] applied series: [PATCH storage v4 1/4] fix #3972: Remove the .notes file when a backup is deleted Wolfgang Bumiller
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=20220614090013.84500-2-d.tschlatscher@proxmox.com \
--to=d.tschlatscher@proxmox.com \
--cc=pve-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