container-export: Handle metacopy=off overlay setups#2097
container-export: Handle metacopy=off overlay setups#2097jeckersb merged 1 commit intobootc-dev:mainfrom
Conversation
This fixes a bug in `container export` on overlayfs setups with `metacopy=off` (a common setup). In that scenario we will see a single mountpoint, but different device+inode. Change hardlink tracking to account for device+inode. Assisted-by: OpenCode (Claude Opus 4) Signed-off-by: Colin Walters <walters@verbum.org>
There was a problem hiding this comment.
Code Review
This pull request updates the hardlink tracking logic in container_export.rs to use a combination of device ID and inode number as the key, rather than just the inode. This change accommodates overlay filesystems where device numbers may differ between directories and files. Additionally, the explicit check for an expected device ID has been removed. I have no feedback to provide.
| let filename_path = Path::new(filename); | ||
| let metadata = dir.metadata(filename_path)?; | ||
|
|
||
| // Skip files on different devices (e.g., bind mounts in containers like /etc/hosts). |
There was a problem hiding this comment.
Does this mean that now we would start including the bind-mounted /etc/hosts when we export?
There was a problem hiding this comment.
As documented, this expects the image as a separate mount point:
podman run --rm \
--mount=type=image,source=quay.io/example/example,target=/run/target \
quay.io/example/example \
bootc container export --kernel-in-boot /run/target > example.tar
And in that case, there won't be any container runtime injected content like /etc/hosts.
There was a problem hiding this comment.
(IOW I messed this up originally, the previous code was never necessary)
This fixes a bug in
container exporton overlayfs setups withmetacopy=off(a common setup). In that scenario we will see a single mountpoint, but different device+inode.Change hardlink tracking to account for device+inode.
Assisted-by: OpenCode (Claude Opus 4)