]> git.proxmox.com Git - pve-storage.git/commitdiff
fix volume activation for ZFS subvols
authorFabian Ebner <f.ebner@proxmox.com>
Thu, 19 Nov 2020 10:29:53 +0000 (11:29 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sun, 22 Nov 2020 17:36:23 +0000 (18:36 +0100)
When using the path to request properties, and no ZFS file system is mounted
at that path, ZFS will fall back to the parent filesystem:

> # zfs unmount myzpool/subvol-172-disk-0
> # zfs get mounted /myzpool/subvol-172-disk-0
> NAME     PROPERTY  VALUE    SOURCE
> myzpool  mounted   yes      -
> # zfs get mounted myzpool/subvol-172-disk-0
> NAME                       PROPERTY  VALUE    SOURCE
> myzpool/subvol-172-disk-0  mounted   no       -

Thus, we cannot use the path and need to use the dataset directly.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/Storage/ZFSPoolPlugin.pm

index 07540b3ecb5b44ea3c2fa6e312e0622fdf678b73..2f0a80a4613a6eef0256730c261661745a5ef6ff 100644 (file)
@@ -549,15 +549,14 @@ sub activate_volume {
 
     return 1 if defined($snapname);
 
-    my (undef, undef, undef, undef, undef, undef, $format) = $class->parse_volname($volname);
+    my (undef, $dataset, undef, undef, undef, undef, $format) = $class->parse_volname($volname);
 
     if ($format eq 'raw') {
        $class->zfs_wait_for_zvol_link($scfg, $volname);
     } elsif ($format eq 'subvol') {
-       my ($path, undef, undef) = $class->path($scfg, $volname, $storeid);
-       my $mounted = $class->zfs_get_properties($scfg, 'mounted', "$path");
+       my $mounted = $class->zfs_get_properties($scfg, 'mounted', "$scfg->{pool}/$dataset");
        if ($mounted !~ m/^yes$/) {
-           $class->zfs_request($scfg, undef, 'mount', "$path");
+           $class->zfs_request($scfg, undef, 'mount', "$scfg->{pool}/$dataset");
        }
     }