mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Schwartz" <davids@webmaster.com>
To: <linux-kernel@vger.kernel.org>
Subject: RE: slow open() calls and o_nonblock
Date: Mon, 4 Jun 2007 13:32:53 -0700	[thread overview]
Message-ID: <MDEHLPKNGKAHNMBLJOLKGECFEFAC.davids@webmaster.com> (raw)
In-Reply-To: <e7ca40f70706040720k48aae8efg7a4997ce1d6f2450@mail.gmail.com>


Aaron Wiebe wrote:


> David Schwartz wrote:

> > 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).

> I understand, but this is exactly the situation that I'm complaining
> about.  There is no functionality to provide a nonblocking open - no
> ability to come back around and retry a given open call.

I agree. I'm addressing why things can't "just work", not arguing that they
aren't broken or should stay broken. ;)

I think a good solution would be to re-use the 'connect' and 'shutdown'
calls. You would need a new asynchronous flag to 'open' that would mean,
*really* don't block. You would have to follow up with 'connect' to complete
the actual opening -- the 'open' would just assign a file descriptor (unless
it could complete or error immediately, of course).

To asynchronously close such a socket, you simply call 'shutdown'. Once the
'shutdown' completes, 'close' would be guaranteed not to block.

Obviously, being able to 'poll' or 'select' would be a huge plus (while an
'open' or 'close' is in progress, of course, otherwise it would always
return immediate availability).

I think this covers all the bases and the only ugly API change is an extra
'open' flag. (Which I think is unavoidable.)

> I'm speaking to my ideal world view - but any application I write
> should not have to wait for the kernel if I don't want it to.   I
> should be able to submit my request, and come back to it later as I so
> decide.

A working generic asynchronous system call interface would be the best
solution, I think. But that may be further off than just an asynchronous
file open/close interface.

> (And I did actually consider writing my own NFS client for about
> 5 minutes.)

Yeah, what a pain that would be. The obvious counter-argument to what I
propose above is that it doesn't handle reads and writes, so why bother with
a complex partial solution?

DS



  parent reply	other threads:[~2007-06-04 20:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-03 18:52 Aaron Wiebe
2007-06-03 19:16 ` Davide Libenzi
2007-06-03 23:56 ` John Stoffel
2007-06-04  1:05   ` Aaron Wiebe
2007-06-04  1:20     ` Neil Brown
2007-06-04 13:59       ` Aaron Wiebe
2007-06-04  1:25     ` Bernd Eckenfels
2007-06-04  0:27 ` David Schwartz
2007-06-04  1:05   ` Al Viro
2007-06-04  1:19 ` Bernd Eckenfels
2007-06-04 13:49 ` Alan Cox
2007-06-04 14:04   ` Aaron Wiebe
2007-06-04 14:17     ` John Stoffel
2007-06-04 14:24       ` Aaron Wiebe
2007-06-04 14:20 ` Aaron Wiebe
2007-06-04 15:42   ` Trond Myklebust
2007-06-04 15:59     ` Aaron Wiebe
2007-06-04 16:26       ` Aaron Wiebe
2007-06-04 19:46         ` Trond Myklebust
2007-06-04 20:32   ` David Schwartz [this message]
2007-06-04 14:39 ` Aaron Wiebe
2007-06-04  3:57 Albert Cahalan

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=MDEHLPKNGKAHNMBLJOLKGECFEFAC.davids@webmaster.com \
    --to=davids@webmaster.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®