Merged
Conversation
This was referenced Jul 14, 2021
jepio
approved these changes
Jul 15, 2021
jepio
reviewed
Jul 15, 2021
With btrfs it's not possible in general to find a single underlying block device because there could be many, but still it is possible for our case since we have a single partition. However, rootdev failed to find it because it uses the device minor and major pair from a "stat" syscall on the mount point. This doesn't work with btrfs because it gives a logical pair instead of one belonging to a block device. Instead of using the minor and major pair, find the underlying block device of a mount point by looking it up in /proc/mounts. The existing traversal code to find the lowest backing device is kept in place by getting the minor and major pair for the found block device.
1cc426a to
d3b9b01
Compare
jepio
approved these changes
Jul 27, 2021
pothos
added a commit
to flatcar-archive/coreos-overlay
that referenced
this pull request
Jul 28, 2021
t-lo
pushed a commit
to flatcar/scripts
that referenced
this pull request
Apr 17, 2023
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.
rootdev: support btrfs
With btrfs it's not possible in general to find a single underlying
block device because there could be many, but still it is possible for
our case since we have a single partition. However, rootdev failed to
find it because it uses the device minor and major pair from a "stat"
syscall on the mount point. This doesn't work with btrfs because it
gives a logical pair instead of one belonging to a block device.
Instead of using the minor and major pair, find the underlying block
device of a mount point by looking it up in /proc/mounts. The existing
traversal code to find the lowest backing device is kept in place by
getting the minor and major pair for the found block device.
cgpt: fix cause for compiler warning
How to use/Testing done
This was built and tested with the coreos-overlay branch
kai/bootengine-verity-hashoffsetfrom flatcar-archive/coreos-overlay#1106 and flatcar-scripts branchkai/btrfs-usr-oemfrom flatcar/scripts#131 in http://jenkins.infra.kinvolk.io:8080/job/os/job/manifest/3029/cldsv/ where the Flatcar image that has a btrfs /usr partition and OEM partition.While the actual switch to a btrfs filesystem on the /usr partition is only possible when all changes are part of a Stable release because update-engine needs to know how to handle the new filesystem when updating, we can already do the switch for the OEM partition.