• Han-Wen Nienhuys's avatar
    fs: buffer error in directory reads · 17756c7c
    Han-Wen Nienhuys authored
    Previously, if a DirStream.Next() call would return error, we would
    return the buffered data as well as the errno code in the same
    request.
    
    This would confuse the kernel, who interprets this as an invalid
    response, returning syscall.EIO to the caller.
    
    To fix this, also buffer the errno as overflow entry in the fileEntry
    struct. When we encounter an error, return thus far read entries with
    success. The following read contains just the error.
    
    For testing this properly, loopbackDirStream (which reads directory
    contents) must also buffer error returns.
    
    Change-Id: Ideb8ea6f540de9189a0f366efca0db2205e5dec3
    17756c7c
dirstream_linux.go 2.3 KB