X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=PVE%2FStorage%2FPlugin.pm;h=31b8541dc53134007c6bf0b2344b3f3dd4a2c427;hb=f5451f288dba1eec8d679193b66813fe0b693690;hp=6e73547bcb2426a3afce0a8f95a8f82fe6ce0551;hpb=69e7407e4534587bf19ce94193bec3ddf4198db0;p=pve-storage.git diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm index 6e73547..31b8541 100644 --- a/PVE/Storage/Plugin.pm +++ b/PVE/Storage/Plugin.pm @@ -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"; }