An administrator changing link-exdev during a request could make source selection use one mode and link construction another. Read the option once per request and use that value for both. Document that branch selection and target construction share one branch snapshot, while the replacement symlink is created by the symlink create policy on the current branch configuration.
2.5 KiB
link-exdev
If using path preservation and a link fails with EXDEV make a call
to symlink where the target is the oldlink and the linkpath is
the newpath. The target value is determined by the value of
link-exdev.
link-exdev=passthrough: Return EXDEV as normal.link-exdev=rel-symlink: A relative path from the newpath.link-exdev=abs-base-symlink: An absolute value using the underlying branch.link-exdev=abs-pool-symlink: An absolute value using the mergerfs mount point.- Defaults to
passthrough.
Replacement symlinks retain the source inode's UID and GID where
supported, read without following a source symlink. Relative and pool
targets use the first getattr-policy source branch; absolute branch
targets use the source selected by the open policy. The replacement
is prepared before publication in the daemon-private
.mergerfs_symlink_exdev directory at the branch root. An inherited
setgid bit is cleared on the pinned staging directory before creation so
source credentials produce the source UID and GID. Any remaining
ownership fixup is made through a pinned file descriptor. Linux
publishes with a no-replace rename or a hard link from the private
staging directory; neither replaces an existing link destination.
FreeBSD corrects the pinned symlink's ownership and publishes it with
a hard link from the private staging directory.
If the source ownership cannot be represented or the verified symlink
cannot be published, the fallback fails rather than publishing a link
with the daemon's UID or a setgid parent's GID. The link request's
UID/GID is never used: it may be invalid when allow-idmap is enabled.
In a sticky, world-writable directory (such as a shared /tmp-like
directory) a symlink can only be followed by its owner unless the
directory's owner also owns it (Linux's fs.protected_symlinks, on by
default). A replacement symlink owned by the source's owner there would
be unusable by everyone else, root included, so in that case mergerfs
does not use the fallback and returns EXDEV, as if it were set to
passthrough.
Source branch selection and target path construction retain the same branch snapshot, even when the branch list is updated at runtime. The replacement symlink itself is created through the symlink create policy on the current branch configuration, which may differ from that snapshot.
NOTE: It is possible that some applications check the file they link. In those cases, it is possible it will error or complain.