On Wed, Nov 12, 2008 at 2:13 PM,  <[EMAIL PROTECTED]> wrote:
> stat(5) specifies exclusive-access files, which we do use for locking.
> In what sense is that not `doing locking'?  It's not POSIX byte-range
> read- or write-locking per fcntl, but it's not clear to me how often
> that's actually useful.  In quite a few situations, having a single
> process directly access a resource and forcing all other accesses
> through that process suffices.

For special purposes, the canonical solution is probably just to have
a ctl file that accepts commands to manipulate locks.  It's a bit of a
protocol dance in the sense of the calling program having some smarts
about what order it does things in, but wouldn't require changes to 9P
proper.

I recall when we were talking about adding a Tflush message around the
time of 9P2000 and Rob or Russ or someone saying, "that's really the
job of a fileserver."  I didn't fully appreciate what they meant at
that time, thinking solely in terms of disk-based "file servers"
(instead of the more abstract notion of a fileserver as a collection
of related resources with well-defined operations on them) like kenfs,
but it dawned on me (much) later that they were just referring to some
sort of ctl file and a command along the lines of "sync <fid>".
Locking is a natural abstraction of that kind of thing; it could
easily be abstracted into a library function that does the right
thing, much as dial() does.

The one change I wish we could make to 9P is to extend stat and wstat
with a version field, so I could pass domain specific information over
9P.  As a stupid example, combining that with some sort of translator,
I could define a DECnet service that let me manipulate all the VMS and
TOPS-20 specific fields and extended file attributes from those
worlds, but from Plan 9.  All of a sudden, I have access to a
versioned filesystem living under VMS on Itanium.  Not that anyone
would WANT to do such a thing, but it was a simple example that just
popped into my head.  Perhaps a more realistic idea would be assuming
the functionality of the 9P2000.u protocol (which I don't know much
about; the Marines have been keeping me away from Plan 9 for quite
some time now, but as I understand it, it mainly extends 9P to deal
with symlinks for Unix support).

I can't really think of anything you couldn't do with that change and
an appropriately designed ctl interface.  But then again, I've been
out of the game for a little while.

        - Dan C.

Reply via email to