[pve-devel] [PATCH v2 storage 1/7] dir plugin: update notes: don't fail if file is already removed

Fabian Ebner f.ebner at proxmox.com
Thu Sep 30 13:42:04 CEST 2021


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

Changes from v1:
    * Avoid race by always attempting to remove.

 PVE/Storage/DirPlugin.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/PVE/Storage/DirPlugin.pm b/PVE/Storage/DirPlugin.pm
index 2267f11..30ed7ca 100644
--- a/PVE/Storage/DirPlugin.pm
+++ b/PVE/Storage/DirPlugin.pm
@@ -2,8 +2,11 @@ package PVE::Storage::DirPlugin;
 
 use strict;
 use warnings;
+
 use Cwd;
 use File::Path;
+use POSIX;
+
 use PVE::Storage::Plugin;
 use PVE::JSONSchema qw(get_standard_option);
 
@@ -110,7 +113,7 @@ sub update_volume_notes {
     if (defined($notes) && $notes ne '') {
 	PVE::Tools::file_set_contents($path, $notes);
     } else {
-	unlink $path or die "could not delete notes - $!\n";
+	unlink $path or $! == ENOENT or die "could not delete notes - $!\n";
     }
     return;
 }
-- 
2.30.2






More information about the pve-devel mailing list