9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@swtch.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] 9p flush
Date: Thu,  9 Mar 2006 13:55:08 -0500	[thread overview]
Message-ID: <f5684a847374515f64425b1adb81bba8@swtch.com> (raw)
In-Reply-To: <13edff48884a0e3146cf2454fa9c9336@vitanuova.com>

The only requirement is that flush is handled in a timely fashion.
It can't block indefinitely and it shouldn't block on anything
it doesn't have to.  For example, in the worm file server,
if you flush a read, the file server doesn't interrupt the read
but it does mark the read as flushed and reply to the flush
immediately.  It will then not reply to the read once the worm
data arrives.  It would be as correct, though more frustrating
to users typing DEL, if the flush just waited on the worm data.

It's not the case that you can't reply to other messages
between receiving a Tflush and sending the Rflush.
That would be unreasonable since there might be
R-messages in flight that would appear to have been
sent between the two events.

The ultimate reason for all this is that if you have a process
blocked on a 9P message and it gets interrupted, the kernel
sends a Tflush and cannot let the process handle the interrupt
until the Rflush is received.  So it shouldn't take arbitrarily long,
and the faster you can reply the better.

The kernel must wait for the Rflush to find out whether the
op is going to complete successfully.  For example, if you
flush a Twalk, it's important to know whether the Rwalk
comes back or not.  If you get the Rwalk before the Rflush,
then the walk succeeded and the fid has moved (or a new fid
created).  If you get the Rflush with no Rwalk, you know the
Rwalk isn't coming and that the walk never happened.

You can wait for the Rwhatever to go out before you respond
to the Rflush if you want, as long as it's not going to block
indefinitely.  This is what lib9p will do for you if you don't
give a flush handler in the Srv structure.

It is more important to get the semantics right than the timing.

Russ



  parent reply	other threads:[~2006-03-09 18:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-09  6:54 [9fans] web site being down & reliability Russ Cox
2006-03-09 18:30 ` [9fans] 9p flush rog
2006-03-09 18:40   ` jmk
2006-03-09 18:55   ` Russ Cox [this message]
2006-03-09 19:03     ` rog
2006-03-09 18:59       ` Ronald G Minnich
2006-03-09 21:37 ` [9fans] web site being down & reliability Russ Cox

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=f5684a847374515f64425b1adb81bba8@swtch.com \
    --to=rsc@swtch.com \
    --cc=9fans@cse.psu.edu \
    /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;
as well as URLs for NNTP newsgroup(s).