Re: [RFC v2 0/5] Non-blockling buffered fs read (page cache only)

From: Christoph Hellwig
Date: Mon Sep 22 2014 - 10:26:30 EST


On Mon, Sep 22, 2014 at 10:12:21AM -0400, Jonathan Corbet wrote:
> So I'm not contesting this, but I am genuinely curious: do you think
> there are applications out there requesting non-blocking behavior on
> regular files that will then break if they actually get non-blocking
> behavior? I don't suppose you have an example?

You only have to look as far as Samba, but Jeff quoted an old lkml
post earlier that had other examples.

source3/smbd/open.c:


if (first_open_attempt && lp_kernel_oplocks(SNUM(conn))) {
/*
* With kernel oplocks the open breaking an oplock
* blocks until the oplock holder has given up the
* oplock or closed the file. We prevent this by first
* trying to open the file with O_NONBLOCK (see "man
* fcntl" on Linux). For the second try, triggered by
* an oplock break response, we do not need this
* anymore.
*
* This is true under the assumption that only Samba
* requests kernel oplocks. Once someone else like
* NFSv4 starts to use that API, we will have to
* modify this by communicating with the NFSv4 server.
*/
flags2 |= O_NONBLOCK;
}
--
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/