RWF_NOWAIT
RWF_NOWAIT is a per-operation Linux I/O flag requesting that supported operations avoid waiting for unavailable data or contended resources.
With preadv2 since Linux 4.14, this flag can return a short positive byte count; no progress because waiting would be needed yields -1 with errno EAGAIN. Linux 5.9 and 5.10 have a documented premature-zero-return bug. [1]
In Linux v6.17, missing FMODE_NOWAIT support yields EOPNOTSUPP. The generic buffered-read path distinguishes IOCB_NOWAIT from IOCB_NOIO and can initiate readahead before returning EAGAIN. Thus EAGAIN neither identifies a cache miss uniquely nor proves that no storage I/O was started. [2] [3]
Other APIs report completion differently: io_submit uses -EAGAIN in the event's res field for a NOWAIT operation that would block. [4]
Relations
- related
- buffered-io, page-cache, direct-io, posix-fadv-willneed, readahead, io-uring
Limitations
- A caller must handle partial progress and choose a retry or fallback policy rather than treating every nonnegative return as a complete read. [1]
Citations
- Linux man-pages 6.19: readv(2), RWF_NOWAIT and return-value caveats
- Linux v6.17: kiocb_set_rw_flags and FMODE_NOWAIT
- Linux v6.17: filemap_get_pages and filemap_readahead
- Linux man-pages 6.19: io_submit(2), aio_rw_flags and completion results
Sources & caveats
- The detailed buffered-path description is pinned to Linux v6.17; it is not a hard wall-clock latency guarantee for every filesystem or environment.