Messages in this thread | | | Subject | Re: [patch rfc] towards supporting O_NONBLOCK on regular files | From | "Stephen C. Tweedie" <> | Date | Thu, 07 Oct 2004 04:31:35 +0100 |
| |
Hi,
On Wed, 2004-10-06 at 09:01 -0300, Marcelo Tosatti wrote:
> > When attempting to read a file (other than a pipe or FIFO) that supports > > non-blocking reads and has no data currently available: > > o If O_NONBLOCK is set, read( ) shall return -1 and set errno to [EAGAIN]. > > This implies read(O_NONBLOCK) should never block.
The spec is usually pretty careful never to come straight out and require that in all cases, even for true AIO.
> Maybe your code should pass down __GFP_FAIL in the gfp_mask > to the page_cache_alloc() to avoid blocking reclaiming pages, > and possibly pass info down to the block layer > "if this is going to block, fail".
It's not just the page allocation that can block, though. Readahead requires us to map the buffers being read before we submit the async read, so we can still block reading indirect blocks. If we want to avoid submitting that extra synchronous IO, then either O_NONBLOCK needs to avoid readahead entirely for non-present pages, or the readahead itself needs to know that it's a O_NONBLOCK IO and fail cleanly if the metadata is not in cache.
Cheers, Stephen
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |