Skip to content

graphdriver/btrfs: depend on kernel UAPI instead of libbtrfs#44761

Merged
neersighted merged 5 commits intomoby:masterfrom
neersighted:btrfs_uapi
Jan 6, 2023
Merged

graphdriver/btrfs: depend on kernel UAPI instead of libbtrfs#44761
neersighted merged 5 commits intomoby:masterfrom
neersighted:btrfs_uapi

Conversation

@neersighted
Copy link
Copy Markdown
Member

@neersighted neersighted commented Jan 6, 2023

- What I did
Use the kernel UAPI to provide the Btrfs headers, instead of btrfs-progs/libbtrfs

- How I did it
Given #44707 this was a very straightforward substitution with most of the work in research/verification.

- How to verify it
Verify the assumptions (e.g. kernel versions) and use containers to test building on platforms of interest (e.g. EL 7 with newer kernel headers).

- Description for the changelog

  • The Btrfs graphdriver now requires headers from kernel 4.7 or newer. This only affects users building from source. Users on older kernels may opt to not compile this graphdriver, or to provide headers from a newer kernel.

- A picture of a cute animal (not mandatory but encouraged)
image

Comment thread project/PACKAGERS.md Outdated
@neersighted neersighted force-pushed the btrfs_uapi branch 3 times, most recently from 4787ad0 to 2c5ef04 Compare January 6, 2023 17:26
This is actually quite meaningless as we are reporting the libbtrfs
version, but we do not use libbtrfs. We only use the kernel interface to
btrfs instead.

While we could report the version of the kernel headers in play, they're
rather all-or-nothing: they provide the structures and defines we need,
or they don't. As such, drop all version information as the host kernel
version is the only thing that matters.

Signed-off-by: Bjorn Neergaard <[email protected]>
Copy link
Copy Markdown
Contributor

@corhere corhere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

By relying on the kernel UAPI (userspace API), we can drop a dependency
and simplify building Moby, while also ensuring that we are using a
stable/supported source of the C types and defines we need.

btrfs-progs mirrors the kernel headers, but the headers it ships with
are not the canonical source and as [we have seen before][44698], could
be subject to changes.

Depending on the canonical headers from the kernel both is more
idiomatic, and ensures we are protected by the kernel's promise to not
break userspace.

  [44698]: moby#44698

Signed-off-by: Bjorn Neergaard <[email protected]>
While the Cgo in this entire file is quite questionable, that is a task
for another day.

Signed-off-by: Bjorn Neergaard <[email protected]>
We only need suitable UAPI headers now. They are available on kernel 4.7
and newer; out of the distributions currently in support that users
might be interested in, only Enterprise Linux 7 has too old a kernel
(3.10).

Users of Enterprise Linux 7 distros can compile using a newer platform,
disable the Btrfs graphdriver as documented in this file, or use newer
kernel headers on their older distro.

Signed-off-by: Bjorn Neergaard <[email protected]>
This is no longer necessary after the switch to the kernel UAPI.

Signed-off-by: Bjorn Neergaard <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants