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.tschlatsc...@proxmox.com>
---
 PVE/Storage.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 93c3b4e..6f2558f 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);
 }
@@ -1604,7 +1604,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



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

Reply via email to