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] why there is no srv->clunk in lib9p?
Date: Sun,  5 Mar 2006 08:21:12 -0500	[thread overview]
Message-ID: <0736c703fff53d37d8ba88ccad0bfebf@swtch.com> (raw)
In-Reply-To: <82c890d00603050351u4125baf7vc031e178db23bf8@mail.gmail.com>

> why there is no srv->clunk in lib9p?

>From 9p(2):

          Destroyfid
               When a Fid's reference count drops to zero (i.e., it
               has been clunked and there are no outstanding requests
               referring to it), destroyfid is called to allow the
               program to dispose of the fid->aux pointer.

There is no srv->clunk because srv->destroyfid
takes its place.  Srv->destroyfid is called once the
fid's reference count drops to zero, which usually
happens as a result of a Tclunk message, but not always.

In regular a 9P conversation, Tclunk will drop the
last reference to a fid, but you can come up with
various cases where this is not true.  For example,
consider a fid where Tread takes a long time (perhaps
a pipe or /dev/cons or network connection).  What
if a client sent Tread and then without waiting for
the Rread, sent Tclunk.  If there were a clunk handler,
then presumably it would free whatever data structures
were associated with the fid.  But that memory is still
being used by the Tread.  Until all the requests that
reference the fid are done, it is not safe to free the
fid.

Russ



      reply	other threads:[~2006-03-05 13:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-05 11:51 Gabriel Diaz
2006-03-05 13:21 ` Russ Cox [this message]

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=0736c703fff53d37d8ba88ccad0bfebf@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).