Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test/read-mshot-empty: add test case for fully emptying all data
Kernel side explanation: === io_read_mshot() always relies on poll triggering retries, and this works fine as long as we do a retry per size of the buffer being read. The buffer size is given by the size of the buffer(s) in the given buffer group ID. But if we're reading less than what is available, then we don't always get to read everything that is available. For example, if the buffers available are 32 bytes and we have 64 bytes to read, then we'll correctly read the first 32 bytes and then wait for another poll trigger before we attempt the next read. This next poll trigger may never happen, in which case we just sit forever and never make progress, or it may trigger at some point in the future, and now we're just delivering the available data much later than we should have. io_read_mshot() could do retries itself, but that is wasteful as we'll be going through all of __io_read() again, and most likely in vain. Rather than do that, bump our poll reference count and have io_poll_check_events() do one more loop and check with vfs_poll() if we have more data to read. If we do, io_read_mshot() will get invoked again directly and we'll read the next chunk. === Test this by having twice the amount of data available as we have available in a single buffer. If the kernel supports read multishot and isn't behaving properly, this test case will stall waiting on CQEs and eventually get timed out by the test framework. Signed-off-by: Jens Axboe <[email protected]>
- Loading branch information