mirror of
https://github.com/versity/versitygw.git
synced 2026-10-22 14:22:40 +00:00
Uploads copied the request body with io.CopyBuffer, which issues one write per read. Network reads return arbitrary lengths, so the first short read produced an unaligned write and the tmpfile silently reopened buffered for the rest of the object. - Fill the I/O buffer completely before each O_DIRECT write so only the final tail is unaligned; write that tail buffered without treating it as a fallback. - Allocate I/O buffers 4 KiB aligned and use 4 KiB alignment for O_DIRECT lengths and offsets to cover 4Kn devices. - Replace the O_DIRECT read wrapper with a reader that issues aligned preads into an aligned buffer for full and ranged GETs. sendfile from an O_DIRECT fd fails with EINVAL after a partial socket write, so O_DIRECT reads no longer go through sendfile; buffered reads still do. - Debug log unexpected O_DIRECT fallbacks on both paths.