On Fri, Jul 7, 2023 at 11:59 AM Tage Johansson <tage.j.lists@posteo.net> wrote:
On 7/6/2023 7:06 PM, Nir Soffer wrote:

- After calling for example aio_notify_read(3), can I know that the next reading from the file descriptor would block?

No, you have to call again aio_get_direction() and poll again until the event happens.

Well, what I mean is:

After calling aio_notify_read, if aio_get_direction returns AIO_DIRECTION_READ or AIO_DIRECTION_BOTH, can I know that the reading on the file descriptor actually blocked?


Yes - it never blocks.
 

Or might there be cases when aio_notify_read returns and the next direction includes a read and there is still more data to read on the file descriptor? 


Sure it is expected that the socket is readable but more data will be available
later...
 

I guess this is the case, but I must know or the client may hang unexpectedly.


Libnbd uses non-blocking socket so it will never hang.