public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage] fix volume activation for ZFS subvols
Date: Thu, 19 Nov 2020 11:29:53 +0100	[thread overview]
Message-ID: <20201119102953.27271-1-f.ebner@proxmox.com> (raw)

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>
---

See commit 59fdc2b71e5da8eaf3c821a5c55f410f58da200a for more context.
I did build the package as root to run the zfs regressiontests this time.

 PVE/Storage/ZFSPoolPlugin.pm | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 07540b3..2f0a80a 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -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");
 	}
     }
 
-- 
2.20.1





             reply	other threads:[~2020-11-19 10:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19 10:29 Fabian Ebner [this message]
2020-11-23  6:09 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201119102953.27271-1-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal