Skip to content

incusd/storage/zfs: Rework zvol resolution logic#2673

Merged
tych0 merged 3 commits intolxc:mainfrom
stgraber:main
Nov 19, 2025
Merged

incusd/storage/zfs: Rework zvol resolution logic#2673
tych0 merged 3 commits intolxc:mainfrom
stgraber:main

Conversation

@stgraber
Copy link
Copy Markdown
Member

The previous logic was relying either on udev or on a slow crawl through /dev using the zvol_id utility.

This was problematic not just because we could get into timeouts on systems with a LOT of volumes, but also because it was inherently racy. Udev works in the background, so entries may not show up immediately and if something goes wrong during cleanup, we can be left with a symlink pointing to the wrong /dev/zdXYZ device.

This is very similar to the LVM issue we fixed a little while back where in the worst case scenario, it can lead to the wrong block device being accessed, causing corruption or potential data leakage.

The new logic relies entirely on devtmpfs (not udev) and is optimized to try and hit the correct /dev/zdXYZ device almost immediately, limiting the performance impact on busy systems.

Closes #1505

@stgraber stgraber force-pushed the main branch 2 times, most recently from 2744483 to d4946bc Compare November 19, 2025 08:55
@stgraber stgraber marked this pull request as draft November 19, 2025 15:05
Signed-off-by: Stéphane Graber <[email protected]>
The previous logic was relying either on udev or on a slow crawl through
/dev using the zvol_id utility.

This was problematic not just because we could get into timeouts on
systems with a LOT of volumes, but also because it was inherently racy.
Udev works in the background, so entries may not show up immediately and
if something goes wrong during cleanup, we can be left with a symlink
pointing to the wrong /dev/zdXYZ device.

This is very similar to the LVM issue we fixed a little while back where
in the worst case scenario, it can lead to the wrong block device being
accessed, causing corruption or potential data leakage.

The new logic relies entirely on devtmpfs (not udev) and is optimized to
try and hit the correct /dev/zdXYZ device almost immediately, limiting
the performance impact on busy systems.

Closes lxc#1505

Signed-off-by: Stéphane Graber <[email protected]>
This reverts commit ae53328.

Signed-off-by: Stéphane Graber <[email protected]>
@stgraber stgraber marked this pull request as ready for review November 19, 2025 15:20
@tych0 tych0 merged commit 4fce86f into lxc:main Nov 19, 2025
71 of 72 checks passed
tomponline added a commit to canonical/lxd that referenced this pull request Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

ZFS block mode devices sometimes don't appear in time (or disappear)

2 participants