- Relocating only the writer left other opens on the old inode. A later
write through one of them could succeed and disappear after close and
reopen through the pool. Every handle of a kernel node, including
opens made after a rename through mergerfs, now belongs to one group.
Prepare a replacement descriptor for each handle and switch the group
together. An open of the file while a relocation runs waits and gets
the moved file.
- Only a node that can be relocated gets a group: one first opened
while moveonenospc is enabled and without a kernel passthrough ID,
which stays on the original file and can't be switched. Every other
node's handles take no lock. Enabling moveonenospc at runtime
therefore applies to files opened afterwards.
- The switch dup2s each replacement onto the handle's own descriptor
number, so a handle's fd never changes while it is open. Operations
that change the file hold the group's lock shared and wait for a
move. Reads, flush and fsync take no lock and continue on the
original, which the copy matches. fgetattr and statx take a second
lock, which a move holds only from the source unlink until the
switch, so they never report the unlinked original.
- A copy is not a committed move. Prepare all bindings first, then
remove the source; if that fails keep every handle on the original,
clean up the provisional copy when it still denotes this copy, and
return only bytes actually written. A handle whose descriptor number
is at or above the descriptor limit refuses the move, the only way
dup2 could fail after the removal.
- The source was removed before its copy reached disk, so a crash could
leave the name without its data. fsync the copy and the directories
leading to it before removing the source, and the source's directory
after, so on a filesystem that can sync them a crash leaves the
original or a complete copy and never brings the original back over
the copy. A failed sync after the removal is logged; the move has
completed by then. fs::copyfile is split into stage and publish steps
for this; the staged descriptor pins the copy for preparation and
cleanup.
- chmod, chown, utimes and xattr changes reach mergerfs by path and
don't wait for a move. Compare ctime as well as size and mtime, so a
change during the copy makes it retry and one after it refuses the
move, rather than being lost with the source.
- The kernel can reach one file through more than one node: a hardlink
whose other name was removed while both were open, a rename made
directly on a branch while the file was open, or overlapping
branches. A move cannot switch another node's handles, which would
keep writing to the original, so it is refused while any other node
has the file open. The mover checks the canonical descriptor of every
open node. That check and the descriptor limit run after the cheaper
checks, so a full pool doesn't pay for them, and before the copy, so a
lasting refusal doesn't cost a copy per write; they run again just
before the unlink. An open through another node that races the move's
last step is not coordinated with it; moveonenospc.md documents this.
- Also refuse to relocate a file with more than one link or an entry
in the rename-exdev staging tree. Each handle keeps a valid path
after the move.
- New shared acquisitions wait while a relocation is pending, so a
stream of writes to allocated blocks can't starve the mover.
- That wait uses std::atomic wait and notify_all, which libstdc++
first provides in GCC 11, so GCC 11 is now the oldest GCC that
builds mergerfs. GCC 10 accepts -std=c++20 and concepts, so
install-build-pkgs and run-rpmbuild also probe for the atomic
operations: such a compiler is rejected up front, or run-rpmbuild
moves on to a newer toolset. build.md names the minimum.
- moveonenospc kept its enable bit and policy in two fields, which
setxattr changed separately while requests read them. Keep one
atomic policy pointer where null means disabled, and read it once
per relocation. tests.cpp covers enabling, disabling and an invalid
value keeping the previous setting.
- The relocation moves out of fuse_write.cpp into moveonenospc.cpp,
where one function holds every reason to refuse a move.
fs::movefile_and_open no longer opens anything and becomes
fs::movefile, which asks the caller's hooks whether to move and to
switch its handles.
- Document the group behaviour, durability and refusals in
moveonenospc.md.
- TEST_movefile_enospc covers preexisting, secondary and read-only
handles, a hardlinked file, a file open through another node, enabling
moveonenospc while a file is open, repeated relocation with a handle
opened between moves, steady writers, concurrent relocation, reads and
fstat during a copy, a mode change during the copy, and failed source
removal with and without a written prefix, checking held handles and
close/reopen contents. Its fixtures truncate the filler before
unlinking it: a scanner holding the file open kept its space
allocated, which made the hardlink case fail intermittently.
Performance: a file that can't be relocated, because moveonenospc was
disabled when it was first opened or it has a passthrough ID, takes no
locks and allocates nothing; writes no longer take the per-handle lock
they used to. For a relocatable file, reads, flush and fsync take no
lock. Writes and other operations that change the file take the
group's lock shared, about two uncontended atomic operations, and
fgetattr and statx take the second lock, on its own cache line, the
same way. An ENOSPC write takes the lock exclusively only when a move
is possible. Opening and closing files adds no syscall; the first open
of a relocatable file allocates its group. A relocation adds an fstat
per open file to find other nodes of the file. While a file is being
relocated, operations that change it and new opens of it wait for the
copy, as the writer already did; reads and fstat continue.
- When ENOSPC recovery failed after part of a write reached the file
(moveonenospc off, no branch to move to, or the move or retry
failing), write returned the error and dropped the count although
those bytes were on disk. An O_APPEND writer retrying the whole
buffer duplicated them. Return the bytes written as a short write,
as a local filesystem does; a write that wrote nothing still returns
the error.
- The kernel flushes its page cache (cache.writeback, dirty mmap pages)
with writepage requests, ignores the size in the reply and drops the
pages. A short count there lost data while write, fsync, msync and
close all succeeded. Use the request's writepage flag, not the
handle's cache mode, so cached and direct-I/O handles both return the
error for an incomplete flush.
- TEST_movefile_enospc covers a short append, writeback and mmap
flushes and a direct shared mapping where the kernel allows one.
tests.cpp calls the write callback directly so the direct-handle
contract is covered on every kernel. Document both in moveonenospc.md.
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.
rename-exdev (opt-in; the default is passthrough) moves a source it
cannot rename across branches into a staging tree and publishes a
symlink at the destination. This reworks that fallback so a rename
either completes or leaves both names as they were.
- Staging opens every component relative to a pinned parent with
O_NOFOLLOW, requires a daemon-owned staging root, and refuses when
the tree can't be trusted.
- Staged names are taken without replacement and must be free on
every configured branch, not only those holding the source, so a
later lookup cannot reach another rename's payload. Over-long names
are shortened. Fallback renames are serialized.
- Destinations: a compatible existing destination is replaced, kept
under a temporary name until every branch is published, and
restored if a later branch fails. A destination on a read-only
branch, or a no-create one where the link can't be created, is
refused before anything moves. Temporary and restore names never
replace an entry, and a restore that fails is reported.
- An ordinary rename (rename-exdev=passthrough) also refuses with
EXDEV when the destination exists on a read-only branch that does
not hold the source: that copy could neither be replaced nor
removed and would shadow the renamed file there. It is never
scheduled for removal either.
- The replacement symlink is prepared in a daemon-private directory,
its UID and GID are verified through a pinned descriptor, and it is
published without replacement, before any source moves. A sticky,
world-writable destination directory under Linux protected symlinks
is refused. Each prepared link is tracked by identity for cleanup.
- Symlink sources are recreated with their original text, owner and
times instead of staged, since staging changes where a relative
target resolves. Sources of different types on different branches
are refused. A hidden source that cannot be removed fails the rename.
- libfuse re-parents the kernel's node onto the staged inode, using a
name allocated before publication, so open handles and cached
dentries keep working and nothing can fail after the rename commits.
- Without renameat2 (FreeBSD 14.4 and 15.0, or seccomp), regular
files and directories use a portable layout: a fresh daemon-owned
wrapper, access gates that mirror the source's parents with the
source's GID and its read and execute bits only, and the payload
directory inside the last gate. Foreign-owned parents, unsettable
group ownership and non-trivial ACLs are refused before the source
moves. A namespace the source never entered is removed. A portable
directory that can't be restored stays staged with its path logged,
and an existing directory destination is refused before a portable
source moves: keeping it aside would need the no-replace rename the
portable layout lacks.
- Document the fallback, its refusals and FreeBSD limits.
- TEST_rename_exdev_publication, TEST_rename_exdev_portable and
tests.cpp cover publication rollback, shadows, collisions,
ownership, sticky directories, mixed source types, a refused portable
directory destination and the portable layout through a mounted
pool. TEST_rename_exdev_publication keeps its fixture if its tmpfs
can't be detached.
Performance: an ordinary rename only adds an lstat per read-only
branch, and only when one is configured. The fallback adds about two
lstats per branch plus the staging work, and fallback renames run one
at a time.
- The container release driver wrote rv=fail but returned success to
CI. Run every selected target, keep its report line, and exit
nonzero if any target fails or its builder can't run. A missing
podman during --cleanup is reported per target instead of aborting
the run. Reject a target name that matches no containerfile.
- --branch silently defaulted to master, and the tarball containerfile
did too, so a release could package a moving branch instead of the
intended tag. Require --branch and --git-repo for direct calls.
- Remove the static installer target. Its makeself command printed
"foo", and it copied whatever static archives the output directory
held, possibly from an older release or missing one built later in
the same run. The static archives themselves are unchanged.
- git2debcl enumerated every tag and used symmetric differences, so a
private tag could become a package version and commits from another
branch could be listed. Take release and release-candidate tags
reachable from the requested revision, ordered by version with each
final after its candidates, with one-sided ranges between ancestor
boundaries. Keep the requested version when tags share a revision or
a range is empty. A tagless snapshot gets 0~git.<count>.<hash>; a
shallow tagless checkout must give --version.
- Debian versions for candidates are printed as 2.42.0~~rc1, so dpkg
orders them below the 2.42.0 final. The raw -rc1 form sorted above
it, making the final release look like a downgrade.
- TEST_release_metadata covers the driver's results and arguments,
sibling and merged histories, non-release tags, candidates,
tagless and shallow checkouts, and dpkg version ordering.
- Document the static and release targets and the driver's arguments.
make deb moves the generated binary packages to build/pkgs/. The
documented dpkg command still looked in the parent directory and could
fail or pick up an older artifact.
A compiler activated while installing dependencies does not survive in
the caller's shell, so make rpm could fall back to one that can't
compile mergerfs. Route the RPM build through buildtools/run-rpmbuild,
which keeps an explicit compiler and otherwise activates an installed
GCC Toolset when the default can't handle C++20. RPMBUILD and
RPMBUILD_FLAGS override the rpmbuild command.
Rocky 8's toolsets lack the annobin plugin the distribution's RPM
flags load. Test the effective compiler with the RPM flags and pass
--undefine _annotated_build only when that fails, instead of guessing
from the compiler's path in build-mergerfs. Native and container
builds use the same check.
- The helper called Linux fgetxattr on FreeBSD. Read mergerfs.fullpath
there through extattr_get_fd in EXTATTR_NAMESPACE_USER; Linux keeps
user.mergerfs.fullpath.
- FreeBSD mode_t is promoted when passed through an ellipsis, so
reading it back as mode_t was undefined. Read the promoted type.
- O_TMPFILE includes O_DIRECTORY on Linux, so a plain directory open
consumed a mode argument that wasn't passed. Require O_CREAT or the
whole nonzero O_TMPFILE mask.
- The backing path is returned without a terminating NUL. Reject empty
or oversized values and terminate it before reopening; keep the
already-open descriptor when no usable path is available.
- The reopen of the backing file repeated O_TRUNC, and creat() ran
creat() again. The open through mergerfs had already truncated that
file, so the second truncation could only destroy data another
process wrote in between. Drop O_TRUNC from the reopen and reopen
creat()ed files O_WRONLY.
- fopen and fopen64 reopened the branch path with the caller's mode,
so w truncated a second time and a could recreate a name removed in
between. Redirect only modes starting with r, including r+, as
given, and keep the original stream otherwise; tooling.md says so.
TEST_preload_fopen_modes checks the bytes and that a missing branch
name is not created.
- fs_fstatat.hpp used AT_SYMLINK_NOFOLLOW without including fcntl.h,
which failed against FreeBSD headers.
- func.readdir=cor appended entries in whichever order branch workers
finished. Directory offsets are positions in that list, so a reader
reopening an unchanged directory and seeking to a previously issued
cookie (NFS does this) could see a duplicate and miss a later entry.
Read branches concurrently into their own buffers, then merge and
deduplicate them in configured branch order. The merge mutex is gone.
- Growing a dirents buffer overwrote the only pointer with realloc's
result while recording the new capacity, so an allocation failure
leaked the buffer and the next fill wrote through NULL. Grow both
vectors without changing pointer, length or capacity until the
allocation succeeds, and return ENOMEM.
- seq and cosr ignored that failure and served a listing with entries
missing. Every policy now returns the error, and libfuse resets the
handle's buffer whenever a fill fails, so a later request at a
nonzero offset re-enumerates instead of serving a partial or stale
listing as success. cosr closes the directories its workers opened
when it gives up early.
- Document the fill-error contract, which doesn't promise that every
branch was read: seq and cosr can treat a branch read error as the
end of the directory. Document cor's memory use, and refer to
func.getattr, not fuse.getattr.
- TEST_readdir_cor_cookie_replay compares cor listings, offsets and
inodes with seq and replays cookies on fresh handles.
TEST_dirents_allocation injects allocation failures into the dirents
code. TEST_readdir_cor_enomem fails one allocation in a mounted
daemon for cor and seq and checks the same handle then serves the
exact suffix.
Performance: cor copies each entry twice and merges serially after the
parallel reads. Listing 100,000 entries over 4 tmpfs branches took
the same time before and after (81-83 ms per listing for cor:4 and
seq). Peak daemon memory for cor:4 dropped from 27.4 MB to 18.7 MB.
- A failed statvfs was cached as a success: for the next cache.statfs
seconds every caller got the entry's old or zeroed stats and create
policies chose branches from them. Keep a failure as an error for the
timeout, like a success, so a slow failing branch isn't retried under
the lock by every caller in turn. Document that the branch then stays
excluded from space-based create policies until the timeout expires.
- A new entry was told apart from a fresh one only by a time of 0, so a
timeout of at least the current time in seconds returned the zeroed
struct as success. Give entries a valid flag set by the first
statvfs, and measure age with a steady clock from when statvfs
returned.
- cache.statfs given at mount was stored but never applied. Bind the
option directly to the atomic the cache reads, so mount options,
config files and control-file updates follow one path and concurrent
readback no longer races with updates.
- tests.cpp checks that a cached failure is never served as success,
that failures are kept until the timeout, huge timeouts, an invalid
update keeping a cached ENOENT, and a timeout of 0 exposing a newly
created directory immediately.
The sample enabled privileged mode in addition to passing /dev/fuse
and granting SYS_ADMIN. That exposed unrelated host devices and
capabilities to the container. Remove the blanket grant and keep the
same device, capability and propagation settings as the rootful CLI
example.
Docker's default AppArmor profile denies mount(2), so on hosts where
AppArmor is enforcing the container also needs apparmor=unconfined or
a profile that allows the FUSE mount. Say so rather than restoring
privileged mode.
- nfsopenhack adds S_IWUSR|S_IWGRP to a read-only file so the open
can succeed, and resets the mode on the new fd. When the open still
failed, the write bits stayed on the file.
- Pin the inode before changing its permissions. Use that reference for
the temporary mode, retry and restoration, so a concurrent rename
cannot apply the original mode to an unrelated replacement.
- std::stoi threw std::out_of_range for a func.readdir concurrency or
queue depth above INT_MAX, e.g. cor:99999999999. Given at mount,
mergerfs aborted. Set at runtime through .mergerfs, the daemon shut
down and the mount went away, or with process-thread-count>0 the
request never got a reply. Parse with str::from, which reports the
overflow, and reject the value like any other malformed one.
- Reject a readdir queue depth whose product with the concurrency
overflows an int, e.g. cor:2147483647:2147483647, instead of
wrapping it.
- Limit read-thread-count, process-thread-count and the cor/cosr pool
size to 64 threads per pool, after resolving automatic and
CPU-divided counts, and log a warning when clamping. Resolve
negative FUSE counts without overflowing on INT_MIN, and drop the
unreachable negative readdir concurrency branch.
- process-thread-queue-depth is multiplied by the process thread count.
Saturate the product at INT_MAX instead of overflowing.
- Correct the docs: cor/cosr counts accept digits only and 0 means the
core count, at most 8; a queue depth of 0 means 2 per thread;
read-thread-count=0 with process-thread-count=0 is 2 read threads
and max(2, cores - 2) process threads, at most 8; the queue limit is
depth times process threads, each read thread holding one in-flight
buffer of its own. Point at threads.md for how the settings combine.
- Document the per-read-thread /dev/fuse clones and their fallback.
- tests.cpp covers the overflow cases.
Performance: default thread counts are unchanged (8 on hosts with 8 or
more cores). Only explicit or CPU-divided counts above 64, which
2.42.0 honored, are reduced.
- moveonenospc copied from the branch stored when the file was opened,
which a move never updates, so a second ENOSPC on the same handle
tried to copy a path that no longer existed. Find the source branch
from the fd's device and inode at the start of each move, trying the
stored branch first. No match leaves the write's ENOSPC in place.
- The source branch was dropped from the create policy's result, so a
policy returning one branch (ff, mfs, lfs, lus, pfrd) left nothing
when it picked the source, and a destination that was the source by
another path (bind mount) was renamed over the file and unlinked.
Remove every alias of the source before the policy runs, so it picks
another branch; with no candidate left the move is refused.
- Refuse relocation if a duplicate on another branch could become
visible once the source is removed, and publish without replacing a
destination that appeared meanwhile. When the no-replace rename is
unsupported, publish with link(); a staging name that cannot be
removed afterwards is logged instead of silently left behind.
- Ask the create policy by the parent directory, as create does. The
existing-path policies and newest only pick a branch that has the
path they are given, and the destination has the directory but not
the file yet.
- TEST_movefile_enospc moves a handle twice and checks duplicates
through the pool. tests.cpp covers the source by its own path and an
alias, and every existing-path policy for nested and root files.
- getfattr prints the key it was asked for, and the create policies
the example sets and shows are real ones (pfrd, epmfs), not the
nonexistent prfd.
- rpmbuild names its output mergerfs-<version>-1.<dist>.<arch>.rpm,
and the static release archive includes the version in its name.
- --nosignature applies to every distribution that enforces RPM
signatures, not only Fedora 45.
mergerfs stores nothing on its branches by default, but the opt-in
link-exdev and rename-exdev fallbacks create .mergerfs_symlink_exdev/
and .mergerfs_rename_exdev/ at branch roots, and files renamed by
rename-exdev live inside the latter. Say so where the downsides and
migration pages promise that mergerfs can be removed, or the pool
retired, without touching the data.
Keep the mechanism and the recommendations, but drop the promises of
exact runtime messages, log levels and probe results, which vary by
container runtime version. Give the ausearch and sesearch checks
instead. The downsides page now says to omit :z and :Z on mergerfs
bind mounts.
- install-build-pkgs runs as root and handed its compiler choice to
build-mergerfs through /tmp/build-env, which another user could
create before root writes it. Use /etc/mergerfs-build-env, written
to a temporary name, made mode 0644 and renamed into place, so a
normal user can source it regardless of root's umask and never reads
it half written.
- The C++20 probe compiles in a private temporary directory instead of
at fixed names in /tmp.
- yum hosts also consider an already installed devtoolset, which "yum
list available" omits.
- Document sourcing the handoff file before make deb.
- The RELEASE=1 profile replaced 2.42.0's NDEBUG=1 one, but the
static archives and the container image still build with NDEBUG=1,
which therefore selected the debug profile: -O0 -g3 with assertions
on. Both Makefiles accept NDEBUG=1 again, as -O3 -DNDEBUG, and the
debug profile defines DEBUG. The vendored libfuse follows the same
profile as mergerfs.
- make release first removes the objects, binaries and stamp under
build/ and cleans vendored/libfuse, because make only compares
timestamps: objects from an earlier debug build were otherwise
linked into the release binary unchanged. Packages and build reports
in build/pkgs are kept; TEST_release_pkg_preservation checks both.
- make release also builds preload.so. It takes the release defines
through its own PRELOAD_CPPFLAGS: the global CPPFLAGS add
_FILE_OFFSET_BITS=64, which would hide its unsuffixed
open/openat/fopen/creat interposers.
- mergerfs.spec builds the release target, as debian/rules does. The
distribution's CFLAGS, CXXFLAGS and LDFLAGS still apply.
- The release driver mounts the repository with ":ro,z", not ":ro:z",
which Podman read as an extra field instead of a mount option.
TEST_release_metadata runs the driver against a fake podman and
checks the volume argument and the build report.
- Remove release-installer: build-release has no installer target.
- make help printed a literal "\n" where /bin/sh is bash. Match the
build.md transcript to its output and document the profiles.
Performance: static archives and the container image go from -O0 with
assertions back to optimized builds, now -O3 -DNDEBUG (2.42.0: -O2
-DNDEBUG). RPM packages keep the distribution's -O2 and no longer
evaluate assertions. A plain make is unoptimized, as before.
Enable parallel Debian package builds through debhelper, remove Debian 11 release targets, and select the installed GCC Toolset activation script on Rocky Linux 10 while preserving older layouts. Update the build documentation.
- Restore source permissions after ownership to preserve setgid and clear unwanted inherited mode bits.
- Add regression coverage for directory modes, group inheritance, and existing destination directories.
- Update the branch configuration test to use the current API.
- Document metadata preservation when cloning directory paths.
- Stop parent traversal after evaluating the empty relative root.
- Preserve filtering errors, parent fallback, and closest-path selection.
- Cover all four MSP policies with rejection and fallback regressions.
- Document errors when traversal exhausts the branch root.
- Add a top-level Migration page covering both migration directions.
- Explain filesystem reuse, parity constraints, partition requirements,
and unlocking encrypted Unraid disks.
- Describe intact ZFS pool imports and subdirectory branch reuse,
distinguishing them from cases requiring a data copy.
- Add navigation and link the guide from the Unraid comparison.
* Add: a comprehensive downsides FAQ with mitigations and practical
priorities.
* Document: mergerfs-webui and link it from setup and configuration
guides.
* Replace: obsolete mergerfs.fsck references with fsck.mergerfs
guidance.
Describe why mergerfs does not aggregate branch performance like
RAID/ZFS (whose aggregate throughput is also capped by shared
interconnects) and instead provides independent per-branch
performance: best case A+B+C across concurrent streams, worst case
single-stream limited to one branch's speed.