From 40ba91f6703e0095de5bbe8ad64f0084498c9e73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Sun, 8 Sep 2024 14:29:40 -0400 Subject: [PATCH] incusd/storage/zfs: Make sure the zvol is a block device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #1203 Signed-off-by: Stéphane Graber --- internal/server/storage/drivers/driver_zfs_volumes.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/server/storage/drivers/driver_zfs_volumes.go b/internal/server/storage/drivers/driver_zfs_volumes.go index 0c6d3cf5626..f76f66fdab5 100644 --- a/internal/server/storage/drivers/driver_zfs_volumes.go +++ b/internal/server/storage/drivers/driver_zfs_volumes.go @@ -1874,7 +1874,7 @@ func (d *zfs) tryGetVolumeDiskPathFromDataset(ctx context.Context, dataset strin func (d *zfs) getVolumeDiskPathFromDataset(dataset string) (string, error) { // Shortcut for udev. - if util.PathExists(filepath.Join("/dev/zvol", dataset)) { + if util.PathExists(filepath.Join("/dev/zvol", dataset)) && linux.IsBlockdevPath(filepath.Join("/dev/zvol", dataset)) { return filepath.Join("/dev/zvol", dataset), nil } @@ -1914,7 +1914,7 @@ func (d *zfs) getVolumeDiskPathFromDataset(dataset string) (string, error) { continue } - if strings.TrimSpace(output) == dataset { + if strings.TrimSpace(output) == dataset && linux.IsBlockdevPath(entryPath) { return entryPath, nil } }