- 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 and failed with ENOSPC.
- Find the source branch from the fd at the start of each move, as
before e216a81a. findonfs now matches inode as well as device, so
branches on one filesystem are told apart, and tries the stored
branch first. No match leaves the write's ENOSPC in place.
- Drop destinations that are the source directory, matched by device
and inode so another path to it counts. The copy was renamed over
the file and then unlinked, deleting it while the write reported
success. A first move could already pick the source (EDQUOT with
free space); finding the real source let later moves do it too.
With no destination left the write keeps its error.
- TEST_movefile_enospc adds a handle that has to move twice.
tests.cpp covers a move onto the source branch by its own path
and by an alias.
The create policy can legitimately return success with an empty
destination list (e.g. every candidate rejected). Previously we
then dereferenced dst_branch[0] and faulted. Return -ENOSPC so the
original write that triggered the move propagates a sensible errno
to userspace.
Run in an elevated credential mode (root) and let the kernel manage
entitlements. Will result in slightly different behavior but should
not be noticed by most.