- 072b07b6 made a write that fails with ENOSPC after part of it landed
return the bytes written. The kernel issues writes to flush its page
cache (cache.writeback, dirty mmap pages) with the writepage flag
and ignores the size in the reply, then drops the pages. The short
count lost the rest of the data and hid the error: write, fsync,
msync and close all succeeded with half the data on disk, where
2.42.2 returned ENOSPC from fsync or msync.
- Keep the short count for ordinary writes, which the kernel does
handle, and return the error when the request has writepage set.
- TEST_movefile_enospc covers a writeback flush and an mmap msync with
moveonenospc=false; both fail without this change. Note the
exception in moveonenospc.md.
Initialize the flush-test error list before the first I/O operation so
an unexpected error propagates and the descriptor is still closed.
Use the mapping as a context manager for the same reason.