lkml.org 
[lkml]   [2007]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRE: slow open() calls and o_nonblock
David Schwartz writes:
> [Aaron Wiebe]

>> open("/somefile", O_WRONLY|O_NONBLOCK|O_CREAT, 0644) = 1621 <0.415147>
>
> How could they make any difference? I can't think of any
> conceivable way they could.
>
>> Now, I'm a userspace guy so I can be pretty dense, but shouldn't a
>> call with a nonblocking flag return EAGAIN if its going to take
>> anywhere near 415ms? Is there a way I can force opens to EAGAIN if
>> they take more than 10ms?
>
> There is no way you can re-try the request. The open must either
> succeed or not return a handle. It is not like a 'read' operation
> that has an "I didn't do anything, and you can retry this request"
> option.
>
> If 'open' returns a file handle, you can't retry it (since it must
> succeed in order to do that, failure must not return a handle).
> If you 'open' doesn't return a file handle, you can't retry it
> (because, without a handle, there is no way to associate a future
> request with this one, if it creates a file, the file must not be
> created if you don't call 'open' again).
>
> The 'open' function must, at minimum, confirm that the file exists
> (or doesn't exist and can be created, or whatever). This takes
> however long it takes on NFS.

This is not the case, though we might need to allocate a new
flag to avoid breaking things.

Let open() with O_UNCHECKED always return a file descriptor,
except perhaps when failure can be identified without doing IO.
The "real" open then proceeds in the background.

From poll() or select(), you can see that the file descriptor
is not ready for anything. Eventually it becomes ready for IO
or reports an error condition. Both select() and poll() are
capable of reporting errors. If the "real" (background) open()
fails, then the only valid operation is close(). Attempts to
do anything else get EBADFD or ESTALE.

You'll also need a background close().
-
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/

\
 
 \ /
  Last update: 2007-06-04 05:59    [W:0.030 / U:1.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site