public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Reiter <s.reiter@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 4/5] file-restore-daemon/disk: ignore already-mounted error and prefix zpool
Date: Wed, 30 Jun 2021 17:57:58 +0200	[thread overview]
Message-ID: <20210630155759.1894155-5-s.reiter@proxmox.com> (raw)
In-Reply-To: <20210630155759.1894155-1-s.reiter@proxmox.com>

Prefix zpool mount paths to avoid clashing with other mount namespaces
(like LVM).

Also ignore "already-mounted" error and return it as success instead -
as we always assume that a mount path is unique, this is a safe
assumption, as nothing else could have been mounted here.

This fixes an issue where a mountpoint=legacy subvol might be available
on different disks, and thus have different Bucket instances that don't
share the mountpoint cache, which could lead to an error if the user
tried opening it multiple times on different disks.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
 src/bin/proxmox_restore_daemon/disk.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/bin/proxmox_restore_daemon/disk.rs b/src/bin/proxmox_restore_daemon/disk.rs
index f8f67d83..cae62af3 100644
--- a/src/bin/proxmox_restore_daemon/disk.rs
+++ b/src/bin/proxmox_restore_daemon/disk.rs
@@ -192,7 +192,7 @@ impl Filesystems {
                     return Ok(mp.clone());
                 }
 
-                let mntpath = format!("/mnt/{}", &data.name);
+                let mntpath = format!("/mnt/zpool/{}", &data.name);
                 create_dir_all(&mntpath)?;
 
                 // call ZFS tools to import and mount the pool with the root mount at 'mntpath'
@@ -285,6 +285,7 @@ impl Filesystems {
                     return Ok(());
                 }
                 Err(nix::Error::Sys(nix::errno::Errno::EINVAL)) => {}
+                Err(nix::Error::Sys(nix::errno::Errno::EBUSY)) => return Ok(()),
                 Err(err) => {
                     warn!("mount error on '{}' ({}) - {}", source, fs, err);
                 }
-- 
2.30.2





  parent reply	other threads:[~2021-06-30 15:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-30 15:57 [pbs-devel] [PATCH 0/5] Add LVM (thin) support for single file restore Stefan Reiter
2021-06-30 15:57 ` [pbs-devel] [PATCH proxmox-backup-restore-image 1/5] add LVM (thin) tooling Stefan Reiter
2021-06-30 15:57 ` [pbs-devel] [PATCH proxmox-backup 2/5] file-restore-daemon/disk: dedup BucketComponents and make size optional Stefan Reiter
2021-06-30 15:57 ` [pbs-devel] [PATCH proxmox-backup 3/5] file-restore-daemon/disk: fix component path errors Stefan Reiter
2021-06-30 15:57 ` Stefan Reiter [this message]
2021-06-30 15:57 ` [pbs-devel] [PATCH proxmox-backup 5/5] file-restore-daemon/disk: add LVM (thin) support Stefan Reiter
2021-07-02 12:39 ` [pbs-devel] [PATCH 0/5] Add LVM (thin) support for single file restore Fabian Grünbichler
2021-07-05  6:26   ` Thomas Lamprecht
2021-07-05  7:18     ` Fabian Grünbichler
2021-07-05  6:12 ` [pbs-devel] applied-series: " 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=20210630155759.1894155-5-s.reiter@proxmox.com \
    --to=s.reiter@proxmox.com \
    --cc=pbs-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