public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage] fix 3214: DirPlugin: die early if mountpoint not mounted
Date: Tue, 22 Dec 2020 13:18:52 +0100	[thread overview]
Message-ID: <20201222121852.15803-1-a.lauterer@proxmox.com> (raw)

If the `is_mountpoint` option is enabled, it is sensible to first check
for the mountpoint before proceeding any further in the storage
activation.

The old behaviour would create the path to the mountpoint if the `mdkir`
option wasn't set to false. This resulted in mountpoints further up
the path to not mount anymore, e.g. nested ZFS datasets.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---

There is another patch[0] already for this bug report but it deals with
a related, but different problem of not creating the internal storage
directory structure if `mkdir 0` was set.

[0] https://lists.proxmox.com/pipermail/pve-devel/2020-December/046572.html

 PVE/Storage/DirPlugin.pm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/PVE/Storage/DirPlugin.pm b/PVE/Storage/DirPlugin.pm
index 2267f11..81aaf2b 100644
--- a/PVE/Storage/DirPlugin.pm
+++ b/PVE/Storage/DirPlugin.pm
@@ -132,17 +132,17 @@ sub status {
 sub activate_storage {
     my ($class, $storeid, $scfg, $cache) = @_;
 
-    my $path = $scfg->{path};
-    if (!defined($scfg->{mkdir}) || $scfg->{mkdir}) {
-	mkpath $path;
-    }
-
     my $mp = parse_is_mountpoint($scfg);
     if (defined($mp) && !path_is_mounted($mp, $cache->{mountdata})) {
 	die "unable to activate storage '$storeid' - " .
 	    "directory is expected to be a mount point but is not mounted: '$mp'\n";
     }
 
+    my $path = $scfg->{path};
+    if (!defined($scfg->{mkdir}) || $scfg->{mkdir}) {
+	mkpath $path;
+    }
+
     $class->SUPER::activate_storage($storeid, $scfg, $cache);
 }
 
-- 
2.20.1





             reply	other threads:[~2020-12-22 12:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-22 12:18 Aaron Lauterer [this message]
2020-12-22 13:39 ` Wolfgang Bumiller
2020-12-23 14:48   ` Aaron Lauterer

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=20201222121852.15803-1-a.lauterer@proxmox.com \
    --to=a.lauterer@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