]> git.proxmox.com Git - pve-storage.git/commitdiff
remove immutable flag also for subvols on directory storage
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 1 Mar 2017 11:03:40 +0000 (12:03 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 10 Mar 2017 08:21:53 +0000 (09:21 +0100)
or else the removal of such templates (with rootfs size 0) fails

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
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";
     }