mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-12-02 21:00:13 -05:00
fix: report partial writes, but not partial writeback, after ENOSPC
- 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.
This commit is contained in:
parent
86d845e385
commit
93ccc160df
4 changed files with 264 additions and 15 deletions
|
|
@ -34,9 +34,16 @@ 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. The exception is data the
|
||||
kernel is flushing from its page cache (`cache.writeback` or dirty
|
||||
`mmap` pages), including writeback on a direct-I/O handle. The kernel
|
||||
cannot act on a short write for those pages, so the error is returned
|
||||
and reaches `fsync`, `msync` or `close`.
|
||||
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue