I ran into a problem while working on receiving data from nbd source
(Reply to NBD_CMD_READ)
As you know we need to parse the error in Reply Header before we can
proceed reading the data.
Let's say an error occurred so instead of
HEADER1_DATA1..._HEADER2_DATA2... we will
get HEADER1_HEADER2_ DATA2... (as far as I know) so submitting a recv
request to io_uring
with length = sizeof(HEADER1+DATA1) would cause problem as it won't
detect NBD packet boundaries
and will give us as many bytes we ask it (I may be wrong here that's
what I read till now).
A remedy to this would be just submit 'header reads' to io_uring when
we get a read and if header says there were no errors
we can be sure there is length bytes ready to be read in the
buffer(rest of the NBD packet) and read won't block.
Now, as far as I can tell this would work as I expect but our main
concern is avoiding copy_user_enhanced_fast_string
so this won't be nice.
Also attaching metadata (Operation) to read SQE doesn't make sense
because As far as I know io_uring won't be able to tell
the difference the read is for which io_uring request, Reply Header's
handle will tell us which operation in operations vector
does this NBD packet belong to.
Another solution would be opening multiple sockets one for each slot
in operations vector, only one NBD operation runs on a socket
i.e. only one inflight request per socket, that too sounds like a bad idea.
Thanks and regards,
Abhay