blockdev: Add list_dev_by_dir_optional - #2517
Merged
cgwalters merged 1 commit intoSep 30, 2026
Merged
Conversation
bootupd needs to tell "this filesystem has no backing block device" (virtiofs in bcvk ephemeral, NFS root, ...) apart from real errors when finding the device for /boot or /sysroot, so it can skip the bootloader update in the first case. Guessing from the findmnt source string is fragile; the kernel already says it via st_dev, since filesystems without a block device get an anonymous device number with major 0. btrfs and ZFS are the exceptions: they get anonymous device numbers too although they sit on block devices, so recognize them by their statfs magic and resolve them the way list_dev_by_dir already does (findmnt's source for btrfs, the zpool members for ZFS since f61730b). Generated-by: AI Signed-off-by: Colin Walters <walters@verbum.org>
cgwalters
approved these changes
Sep 29, 2026
cgwalters
left a comment
Collaborator
There was a problem hiding this comment.
Looks sane though let's do a followup and add an integration test - useful pattern for this stuff is having an internals command which exposes the functionality at a baseline level run in tmt or so
cgwalters
enabled auto-merge (rebase)
September 29, 2026 21:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
list_dev_by_dir_optional(), which returnsNonewhen the filesystem mounted at a directory has no backing block device instead of failing in lsblk. bootupd needs this to skip the bootloader update on virtiofs (bcvk ephemeral), NFS roots and the like while still failing on real errors (coreos/bootupd#1163).The check is
st_dev: filesystems without a block device get an anonymous device number (major 0). btrfs and ZFS also get anonymous numbers although they are block-backed, so they are recognized by statfs magic and resolved aslist_dev_by_diralready does (ZFS support there is from f61730b, bootc#1240).Tested on a 16-core devspace:
cargo test -p bootc-internal-blockdev,cargo clippy -p bootc-internal-blockdev --all-targets -- -D warningsandjust validatepass.The
Signed-off-by: Colin Walters <walters@verbum.org>on these commits was added on cgwalters's approval of the review draft: cgwalters-forge#33 (review)Generated-by: https://github.com/cgwalters/#llms