fix: report a short write when ENOSPC recovery fails after a prefix

- 78a67fd0 kept the bytes written before ENOSPC when the move worked.
  When it didn't (moveonenospc off, no branch to move to, the move or
  the retry failing, or a non-ENOSPC error), write still returned the
  error and dropped the count, though those bytes were on disk. An
  O_APPEND writer that retried the whole buffer duplicated them.
- Return the bytes written as a short write whenever some reached the
  file, as a local filesystem does. A write that wrote nothing still
  returns the error.
- TEST_movefile_enospc checks it with moveonenospc=false and a write
  bigger than the space left. Document it in moveonenospc.md.
This commit is contained in:
Antonio S. Musumeci 2026-11-22 01:27:22 -05:00
parent 33b0799d6b
commit bc7b7ffeae
3 changed files with 54 additions and 10 deletions

View file

@ -34,9 +34,12 @@ will:
completed append is not duplicated.
If at any point something fails the progress so far will be cleaned up
as appropriate and the original error returned.
as appropriate and the original error returned. If part of the write
already reached the file the bytes written are returned instead, as a
short write, as with a local filesystem.
If `moveonenospc` is disabled the underlying error will be returned.
If `moveonenospc` is disabled the underlying error will be returned,
or the bytes written if part of the write succeeded.
NOTE: This feature has NO effect on policies. It ONLY applies to the
literal write function. If the create function returns `ENOSPC` or the