Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid cross-device link with named volume #14049

Closed
giuseppe opened this issue Apr 28, 2022 · 4 comments · Fixed by #14051
Closed

Invalid cross-device link with named volume #14049

giuseppe opened this issue Apr 28, 2022 · 4 comments · Fixed by #14051
Assignees
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@giuseppe
Copy link
Member

Copied from: coreos/fedora-coreos-tracker#1168

Describe the bug
Running a container in podman on fcos next, fails with an exdev error when it tries to rename a file mounted under a named volume to something in the same directory.

Reproduction steps
Steps to reproduce the behavior:

sudo podman run -v "redpanda-test:/var/lib/redpanda/data" docker.io/vectorized/redpanda:v21.11.12
the first run, it will start ok, you should see a log line with "Successfully started Redpanda!"
the second run, the container exits with Failure during startup: std::__1::__fs::filesystem::filesystem_error (error system:18, filesystem error: rename failed: Invalid cross-device link [/var/lib/redpanda/data/redpanda/kvstore/0_0/snapshot.partial.1649900837775.a1ZO] [/var/lib/redpanda/data/redpanda/kvstore/0_0/snapshot])
Expected behavior
Container should restart without issue, being able to rename the file.

Actual behavior
Container dies with an odd error

System details

  • Bare Metal/QEMU/AWS/GCP/etc. Proxmox VM

  • Fedora CoreOS version next (v 36.20220410.1.1)

Ignition config
very sparse, just ssh keys, networkmanager configs (would be sanitized) and podman.socket.

Additional information
The container starts without issue if I point the directory to a bind mount instead of a named volume. I can only reproduce this on fcos, not on Arch Linux with podman 4.0.3, kernel 5.17.1 or centos 8 stream with podman 4.0.2.

@giuseppe giuseppe self-assigned this Apr 28, 2022
giuseppe added a commit to giuseppe/libpod that referenced this issue Apr 28, 2022
add a new option to completely disable xfs quota usage for a volume.

xfs quota set on a volume, even just for tracking disk usage, can
cause weird errors if the volume is later re-used by a container with
a different quota projid.  More specifically, link(2) and rename(2)
might fail with EXDEV if the source file has a projid that is
different from the parent directory.

To prevent such kind of issues, the volume should be created
beforehand with `podman volume create -o o=noquota $ID`

Closes: containers#14049

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
giuseppe added a commit to giuseppe/libpod that referenced this issue Apr 28, 2022
add a new option to completely disable xfs quota usage for a volume.

xfs quota set on a volume, even just for tracking disk usage, can
cause weird errors if the volume is later re-used by a container with
a different quota projid.  More specifically, link(2) and rename(2)
might fail with EXDEV if the source file has a projid that is
different from the parent directory.

To prevent such kind of issues, the volume should be created
beforehand with `podman volume create -o o=noquota $ID`

Closes: containers#14049

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@dustymabe
Copy link
Contributor

regarding the proposed -o o=noquota solution.. Is it possible to get around this without a special setup beforehand? i.e. If I'm starting a container that's using a volume that has no other owners then re-use the projid or something?

disclaimer: I know very little about XFS. I'm just asking questions.

@giuseppe
Copy link
Member Author

regarding the proposed -o o=noquota solution.. Is it possible to get around this without a special setup beforehand? i.e. If I'm starting a container that's using a volume that has no other owners then re-use the projid or something?

doable but it is more complex. We would need to check that the projid is not used by another container and this would work only when volumes are using the same projid, as well as make sure the quota settings are the same. The real difficulty is that the volume management is done afterwards, so we would need to change a few things before that.

In any case it can be done as a follow up improvement

@nivekuil
Copy link

Should volumes default to noquota for docker compatibility?

@giuseppe
Copy link
Member Author

not sure, that looks more like a missing feature in Docker to not take advantage of quotas to track how much is used by a container

mheon pushed a commit to mheon/libpod that referenced this issue May 3, 2022
add a new option to completely disable xfs quota usage for a volume.

xfs quota set on a volume, even just for tracking disk usage, can
cause weird errors if the volume is later re-used by a container with
a different quota projid.  More specifically, link(2) and rename(2)
might fail with EXDEV if the source file has a projid that is
different from the parent directory.

To prevent such kind of issues, the volume should be created
beforehand with `podman volume create -o o=noquota $ID`

Closes: containers#14049

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
gbraad pushed a commit to gbraad-redhat/podman that referenced this issue Jul 13, 2022
add a new option to completely disable xfs quota usage for a volume.

xfs quota set on a volume, even just for tracking disk usage, can
cause weird errors if the volume is later re-used by a container with
a different quota projid.  More specifically, link(2) and rename(2)
might fail with EXDEV if the source file has a projid that is
different from the parent directory.

To prevent such kind of issues, the volume should be created
beforehand with `podman volume create -o o=noquota $ID`

Closes: containers#14049

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants