Subject: RE: idea - atomic append for NFS writes

From: "Noveck, Dave" <[email-masked]>
Date: Fri, 16 Mar 2001 09:56:31 -0800

> As Peter points out, atomic appends are probably (I say probably,
> because it hasn't been proven they can't be done, its just that every
> proposal has been found to have holes) impossible, although if the
> server has delegated write capability to the client, as long as the
> delegation is in force, appends come for free.

In that case, they are essentially local writes.

I'm not sure that I'm prepared to give up on append writes yet.
The fact that V4 has embraced statefulness may open up some 
other possibilties.  We have stuff that we do exactly-once
through seqids (i.e. locking requests) so there may be a
possibility of building on that approach.  The problem area
is server reboot since the current sequencing mechanisms take
advantage of the fact that for locking, server reboot resets
everything.

> In Mark's proposal, what I envision occuring when (1) there is no
> delegation in force, and (2) high load on the server such that the
> duplicate request cache is blown, is duplicate records from the same
> client written at different offsets. I think, and it has been the
> consensus of the NFS community during the long NFSv3 and NFSv4 processes,
> that this is worse than the current situation, where only if write
> sharing is going on does the file get corrupted during appends.

I think this is only worth doing if we can do it right (i.e. files
don't get corrupted).  Users take such a dim view of that.

> Peter's notion of "reservations" at the end of the file is interesting,
> but (1) as he points out, persistent reservations are required, and (2)
> then there's the problem of what if the client doesn't follow through
> with the write.  To me, those two issues make his append proposal less
> palatable than the status quo.

> The use of a COMPOUND with VERIFY (file size) followed by WRITE comes
> close, but because there's no atomicity guarantee between operations,
> it comes up short. Still, it might be a good idea for NFS client's
> simulating append to use VERIFY to reduce corruption during
> write sharing. But it's early (for me) this morning, and I'm
> probably missing something.

I may not be understanding exactly the form of COMPOUND you are
anticipating using, but it seems that COMPOUND with VERIFY is subject
to exactly the same issue that you identified with Mark's proposal:
duplicate records even in the absence of sharing.  If I do a GETATTR
of the file size and then do a VERIFY-WRITE compound, then if the
verify fails I am going to loop back and do another GETATTR followed 
by a VERIFY-WRITE assuming that somebody else got his record in before 
me.  But in the presence of retries, it may have been that the WRITE 
that got in was an earlier instance of *my* VERIFY-WRITE which succeeded, 
so the second retry (actually the first retry after the initial try)
fails in the VERIFY and I go off to write my record  again.  Since, 
in this mode of operation I'm doing twice as many requests as in 
Mark's proposal, I'm going to hit the problem even earlier.

I know I'm being heretical here, but I'm beginning to think that NFS
may be at the point of exhausting the universe of things that can be
done effectively with at-least-once semantics.  Unless we are prepared
to keep giving people things (like append writes) that work most of
the time and tell them to stop complaining, we may have to bite the
bullet and solve the general problem.

     Exactly-once Semantics -- Accept No Substitutes

---

From: Brent <[email-masked]>
Date: Fri, 16 Mar 2001 11:14:53 -0800

> Mark's proposal, I'm going to hit the problem even earlier.

Good point.  The retry issue is a sticky one.

> bullet and solve the general problem.

I've had similar feelings.  The protocol has accreted a lot of hairy
bits through its lack of at-most-once.  I'm thinking here of the
exclusive create verifier, and perhaps the *_confirm ops.  Yet
implementation of at-most-once assumes that the server will maintain
a record of previous requests that's more persistent than the current
dupreq cache.  Doing a dupreq cache is hard enough, but making it
deterministic and persistent across server reboots, is tough.

	Brent