Repository navigation
A hard link can be made inside a bind mount or named volume - #35
Merged
Merged
Conversation
docker run -v vol:/v alpine sh -c 'echo x > /v/a; ln /v/a /v/b' printed "ln: /v/b: No such file or directory" (Dockiva 0.6.10); on Linux it works, and so did the same link in the container's own layer. linkat refused a source the walk found in neither image layer (layer 2) with ENOENT before asking the host. For a leaf inside a bind mount the walk leaves the layer at 2 and the canonical path empty: the layers do not apply there. So every source in a mount counted as missing whenever the container had image layers. The check now applies only to a leaf in the layers; in a mount the host's linkat reports a missing source. Links across a mount's boundary are EXDEV as before (decided earlier, by the mounts of the two paths). tests/native/mountlink_guest.c (scripts/verify_overlay.py, every built runtime, with and without the memory layer): a link inside a mount by absolute path, by a descriptor of the mount's directory and through a symlink with AT_SYMLINK_FOLLOW shares the source's inode; a missing source is ENOENT, a taken name EEXIST; a link to another mount, or to or from the layers, is EXDEV; links of image files still copy up. The verifier then checks the host's directories: one inode under three names, nothing in the other mount.
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.
Problem
On Dockiva 0.6.10:
Linux makes the link. The same call in the container's own layer worked.
Cause
linkatinnative/fs.hrefused a source the walk found in neither image layer (old.layer==2) with ENOENT before asking the host. For a leaf inside a bind mount,ov_walkleavesov_leaf.layerat 2 andov_leaf.canonempty, because the layers do not apply there. So every source in a mount counted as missing whenever the container had image layers.Fix
One condition: the check applies only when
old.canon[0]is set (a leaf in the layers). In a mount the host'slinkatreports a missing source. The neighbouringov_prepareandov_createdcalls already return early for an emptycanon, and EXDEV across a mount boundary is decided earlier from the two paths' mounts, unchanged.Test
tests/native/mountlink_guest.c, run byscripts/verify_overlay.pyon every built runtime, with and without the memory layer (--lower,--root,--bindat/voland/vol2):AT_SYMLINK_FOLLOW)On
origin/mainthe guest fails at the first in-mount link on all 8 runs.Checks run locally
scripts/verify_overlay.py: 53/53 (4 runtime builds)scripts/verify_fork_sockets.py: 100/100, twice. One earlier run failedhvf sleeper_guest --cpus 2(a latency check) with the Mac at load 13; standalone it passes 6/6 on this branch and onorigin/main.Not checked: a bundle built from this branch with the
docker run -vcommand above.Note for #34
tests/native/rootdac_guest.cthere makes hard links only in/wbecause of this bug. This branch touchesscripts/verify_overlay.pyat different places than #34 (no textual overlap expected).