Skip to content

blockdev: Add list_dev_by_dir_optional - #33

Closed
cgwalters-bot wants to merge 1 commit into
mainfrom
bot/blockdev-optional-dev
Closed

cgwalters-bot wants to merge 1 commit into
mainfrom
bot/blockdev-optional-dev

Conversation

@cgwalters-bot

Copy link
Copy Markdown
Collaborator

Add list_dev_by_dir_optional(), which returns None when 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 as list_dev_by_dir already 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 warnings and just validate pass.

Generated-by: https://github.com/cgwalters/#llms


Review draft in cgwalters-forge, not upstream yet. This section is removed when the PR is opened upstream.

  • Upstream: bootc-dev/bootc, base main
  • Board item: PVTI_lAHOAQ_SPs4Bj2Gizg9iDPA
  • Fork CI: off; the devspace testing described above is this PR's CI, and upstream CI runs once it is opened there

To review:

  • Approve, or comment /promote on a line of its own, to open it upstream, ready for review. Either covers only the commits pushed so far.
  • If upstream requires DCO, approving also signs off: promote adds Signed-off-by: Colin Walters <walters@verbum.org> to the commits lacking it (the bot's and yours; anyone else's only if you ask), with you as committer.
  • Add a /draft line (in the same comment or before) to open it upstream as a draft (/ready undoes that).
  • Close to drop it.
  • Edit the title and description freely: they become the upstream PR's. Review comments are squashed into the commits they concern, with a reply here.

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-bot

Copy link
Copy Markdown
Collaborator Author

Signed off 1 commit(s) with Signed-off-by: Colin Walters <walters@verbum.org> for bootc-dev/bootc's DCO check, on cgwalters's approval #33 (review) of d17fa1488a5c. Same trees; the head is now ee01e4d1f680.

@cgwalters-bot
cgwalters-bot force-pushed the bot/blockdev-optional-dev branch from d17fa14 to ee01e4d Compare September 29, 2026 21:42
@cgwalters-bot

Copy link
Copy Markdown
Collaborator Author

Opened upstream as bootc-dev#2517. Closing this review draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants