Skip to content

Commit

Permalink
Merge pull request #1204 from stgraber/main
Browse files Browse the repository at this point in the history
incusd/storage/zfs: Make sure the zvol is a block device
  • Loading branch information
hallyn authored Sep 9, 2024
2 parents e213b73 + 40ba91f commit 8db6c73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/server/storage/drivers/driver_zfs_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit 8db6c73

Please sign in to comment.