Re: [patch rfc] towards supporting O_NONBLOCK on regular files

From: Alexandre Oliva
Date: Sun Oct 17 2004 - 03:01:49 EST


On Oct 15, 2004, Jeff Moyer <jmoyer@xxxxxxxxxx> wrote:

jmoyer> Yes, that sounds like a fine idea. Here is a patch which does
jmoyer> this. Andrew, I know you only want bug fixes, but I'd like to get
jmoyer> this into your queue for post 2.6.9, if possible.

> I got the partial read case wrong in the last patch. In fact, it looks
> like this code path would perform infinite retries before. This should
> address that by returning upon the first partial read. Attached is a new
> version of the patch.

Don't you have to adjust poll/select as well, to test whether read has
any data to return immediately? Squid is broken with the latest
FCdevel kernel, and this patch is in it.

The reason Squid breaks is that poll (or is it select? I forget) says
there's data to be read from cache files (as well as from error
message files read during start up), but then read fails with -EAGAIN.
If I bring the error files into memory with cat
/etc/squid/errors/ERR*, then squid will successfully start up, and
then, in order for it to not eat all the available CPU polling data
files and attempting to read from them, I need to start a command line
this:

pid=`pidof '(squid)'
while :; do
lsof -p $pid |
sed -n 's,.*\(/var/spool/squid/.*/.*/.*\),\1,p' |
xargs cat /dev/null > /dev/null;
sleep 5
done

--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/