From 6c4f762c49bc1fadae42fd65b183c6c4fd1ca478 Mon Sep 17 00:00:00 2001 From: Stefan Reiter Date: Wed, 30 Jun 2021 17:57:58 +0200 Subject: [PATCH] file-restore-daemon/disk: ignore already-mounted error and prefix zpool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Fabian Grünbichler --- 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); }