]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage/Plugin.pm
remove immutable flag also for subvols on directory storage
[pve-storage.git] / PVE / Storage / Plugin.pm
index 6e73547bcb2426a3afce0a8f95a8f82fe6ce0551..31b8541dc53134007c6bf0b2344b3f3dd4a2c427 100644 (file)
@@ -597,6 +597,12 @@ sub free_image {
 
     my $path = $class->filesystem_path($scfg, $volname);
 
+    if ($isBase) {
+       # try to remove immutable flag
+       eval { run_command(['/usr/bin/chattr', '-i', $path]); };
+       warn $@ if $@;
+    }
+
     if (defined($format) && ($format eq 'subvol')) {
        File::Path::remove_tree($path);
     } else {
@@ -606,12 +612,6 @@ sub free_image {
            return undef;
        }
 
-       if ($isBase) {
-           # try to remove immutable flag
-           eval { run_command(['/usr/bin/chattr', '-i', $path]); };
-           warn $@ if $@;
-       }
-
        unlink($path) || die "unlink '$path' failed - $!\n";
     }