Skip to content

[23.0 backport] graphdriver/btrfs: depend on kernel UAPI instead of libbtrfs#44776

Merged
neersighted merged 7 commits into
moby:23.0from
thaJeztah:23.0_backport_btrfs_uapi
Jan 10, 2023
Merged

[23.0 backport] graphdriver/btrfs: depend on kernel UAPI instead of libbtrfs#44776
neersighted merged 7 commits into
moby:23.0from
thaJeztah:23.0_backport_btrfs_uapi

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

thaJeztah and others added 7 commits January 10, 2023 10:45
Signed-off-by: Sebastiaan van Stijn <[email protected]>
(cherry picked from commit 7fbf321)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
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]>
(cherry picked from commit 1449c82)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
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]>
(cherry picked from commit 3208dca)
Signed-off-by: Sebastiaan van Stijn <[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]>
(cherry picked from commit d3778d6)
Signed-off-by: Sebastiaan van Stijn <[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]>
(cherry picked from commit c9d632e)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
This is no longer necessary after the switch to the kernel UAPI.

Signed-off-by: Bjorn Neergaard <[email protected]>
(cherry picked from commit aa80c33)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
`linux/btrfs_tree.h` was not installed to `/usr/include` until kernel 4.12
torvalds/linux@fcc8487

Signed-off-by: Akihiro Suda <[email protected]>
(cherry picked from commit 89fb8b3)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
@neersighted neersighted merged commit fc690c5 into moby:23.0 Jan 10, 2023
@thaJeztah thaJeztah deleted the 23.0_backport_btrfs_uapi branch January 10, 2023 15:50
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.

3 participants