diff --git a/mkdocs/docs/config/link-exdev.md b/mkdocs/docs/config/link-exdev.md index fa351997..656d3524 100644 --- a/mkdocs/docs/config/link-exdev.md +++ b/mkdocs/docs/config/link-exdev.md @@ -39,6 +39,12 @@ 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. diff --git a/src/fuse_link.cpp b/src/fuse_link.cpp index 6ea2aff3..f1595e84 100644 --- a/src/fuse_link.cpp +++ b/src/fuse_link.cpp @@ -292,8 +292,11 @@ _link_exdev(const fs::path &oldpath_, fs::path oldfullpath; std::vector oldbranches; const Policy::Search *sourcePolicy; + // Read once: link-exdev can be changed at runtime and the source + // branch selection below must match the mode dispatched on. + const LinkEXDEV::ENUM mode = cfg.link_exdev; - switch(cfg.link_exdev) + switch(mode) { case LinkEXDEV::ENUM::REL_SYMLINK: case LinkEXDEV::ENUM::ABS_POOL_SYMLINK: @@ -320,7 +323,7 @@ _link_exdev(const fs::path &oldpath_, const ugid_t owner{source.st_uid,source.st_gid}; - switch(cfg.link_exdev) + switch(mode) { case LinkEXDEV::ENUM::PASSTHROUGH: return -EXDEV;