From: "Stephen C. Tweedie" <sct@redhat.com>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: Jeff Moyer <jmoyer@redhat.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@redhat.com>, Stephen Tweedie <sct@redhat.com>
Subject: Re: [patch rfc] towards supporting O_NONBLOCK on regular files
Date: Thu, 07 Oct 2004 04:31:35 +0100 [thread overview]
Message-ID: <1097119895.4339.12.camel@orbit.scot.redhat.com> (raw)
In-Reply-To: <20041006120158.GA8024@logos.cnet>
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
next prev parent reply other threads:[~2004-10-07 3:29 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-01 20:57 [patch rfc] towards supporting O_NONBLOCK on regular files Jeff Moyer
2004-10-03 19:48 ` Pavel Machek
2004-10-13 14:28 ` Jeff Moyer
2004-10-14 17:39 ` Pavel Machek
2004-10-05 11:27 ` Marcelo Tosatti
2004-10-06 13:13 ` Jeff Moyer
2004-10-06 12:01 ` Marcelo Tosatti
2004-10-07 3:31 ` Stephen C. Tweedie [this message]
2004-10-07 10:12 ` Marcelo Tosatti
2004-10-07 12:30 ` Arjan van de Ven
2004-10-11 18:32 ` Stephen C. Tweedie
2004-10-11 18:58 ` Jeff Moyer
2004-10-11 21:49 ` Stephen C. Tweedie
2004-10-13 14:26 ` Jeff Moyer
2004-10-15 15:44 ` Jeff Moyer
2004-10-15 16:19 ` Stephen C. Tweedie
2004-10-17 7:59 ` Alexandre Oliva
2004-10-17 11:20 ` Ingo Molnar
2004-10-17 19:38 ` Alexandre Oliva
2004-10-18 16:51 ` Jeff Moyer
2004-10-19 6:04 ` Alexandre Oliva
2004-10-21 20:14 ` James Antill
2004-10-05 15:35 ` Rik van Riel
-- strict thread matches above, loose matches on Subject: below --
2004-10-05 13:07 Dan Kegel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1097119895.4339.12.camel@orbit.scot.redhat.com \
--to=sct@redhat.com \
--cc=jmoyer@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
--cc=mingo@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox