[pbs-devel] [PATCH proxmox-backup 4/5] file-restore-daemon/disk: ignore already-mounted error and prefix zpool

Stefan Reiter s.reiter at proxmox.com
Wed Jun 30 17:57:58 CEST 2021


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






More information about the pbs-devel mailing list