As glibc POSIX AIO switches over completely to using native AIO it needsbasic AIO support for various file types - including sockets, pipes etc.Since userland will no longer be simulating asynchronous behaviourwith threads, it expects the underlying implementation to be asynchronous.Which is still an issue with native linux AIO.

One (not so appealing) alternative that has been considered in the past isa fallback path that spawns a kernel thread per AIO request. This in somesense amounts to pushing the problem down from user to kernel space.Fortunately we can do better. We can effectively simulate AIO in kernelusing async poll and O_NONBLOCK for all pollable fds, i.e. sockets, pipesetc.

With this scheme in place, all that needs to be done to add AIO supportfor any pollable file type is to make sure that the corresponding f_op->aio_read/aio_write implements O_NONBLOCK behaviour if called inaio context, i.e. with an async kiocb. The high level common AIO codetakes care of the rest, by enabling retries for completing the rest ofthe IO to be initiated directly via poll wait notifications.

This fallback option should be good enough to get us to working POSIX AIO,now that filesystem AIO already takes care of ISREG files which do notsupport O_NONBLOCK. I have tested this with modified pipetest runs, alsousing sockets instead of pipes.