[pve-devel] [PATCH storage] btrfs: call free_image correctly

Fabian Ebner f.ebner at proxmox.com
Mon Sep 20 12:23:02 CEST 2021

Currently, 'PVE::Storage::DirPlugin' is implicitly passed along as
$class, which means that if the base class's free_image calls another
method (e.g.  filesystem_path) then the DirPlugin's method will be
used, rather than the one from BTRFSPlugin. Change it so that $class
itself is passed along.

See also commit 279d9de5108f6fc6f2d31f77f1b41d6dc7a67cb9 for context,
where the approach in this patch was suggested.

Suggested-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
 PVE/Storage/BTRFSPlugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/Storage/BTRFSPlugin.pm b/PVE/Storage/BTRFSPlugin.pm
index dbc1244..b30000b 100644
--- a/PVE/Storage/BTRFSPlugin.pm
+++ b/PVE/Storage/BTRFSPlugin.pm
@@ -410,7 +410,7 @@ sub free_image {
     if (!defined($format) || ($format ne 'subvol' && $format ne 'raw')) {
-	return PVE::Storage::DirPlugin->free_image($storeid, $scfg, $volname, $isBase, $_format);
+	return $class->SUPER::free_image($storeid, $scfg, $volname, $isBase, $_format);
     my $path = $class->filesystem_path($scfg, $volname);

More information about the pve-devel mailing list