[lkml]   [2004]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [patch rfc] towards supporting O_NONBLOCK on regular files

    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.


    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 14:06    [W:0.028 / U:38.756 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site