file-restore-daemon/disk: ignore already-mounted error and prefix zpool

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>
Reviewed-By: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Stefan Reiter 2021-06-30 17:57:58 +02:00 committed by Thomas Lamprecht
parent 7a0afee391
commit 6c4f762c49
1 changed files with 2 additions and 1 deletions

View File

@ -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);
}