From mboxrd@z Thu Jan 1 00:00:00 1970 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] QTCTL? In-reply-to: Your message of "Wed, 31 Oct 2007 17:40:28 EDT." From: Bakul Shah Date: Wed, 31 Oct 2007 23:21:33 -0700 Message-Id: <20071101062133.49DF25B30@mail.bitblocks.com> Topicbox-Message-UUID: e2a1d43a-ead2-11e9-9d60-3106f5b1d025 > What you really need is a way to ask the server "can I > cache the following?" and have the server say yes or no > and then have some way to invalidate the cache, so that > you get coherent behavior, even in the above case. > We discussed various ways to add this to the protocol > but ultimately we didn't see any way that was simple > enough that the specification effort wasn't outweighed > by our not needing to solve the problem at that time. Do you recall what the issues were? Wouldn't something like load-linked/store-conditional suffice if the common case is a single writer? When the client does a "read-linked" call, the server sends an ID along with the data. The client can then do a "write-conditional" by passing the original ID and new data. If the ID is not valid anymore (if someone else wrote in the meantime) the write fails. The server doesn't have to keep any client state or inform anyone about an invalid cache. Of course, if any client fails to follow this protocol things fall apart but at least well behaved clients can get coherency. And this would work for cases such as making changes on a disconnected laptop and resyncing to the main server on the next connect. You wouldn't use this for synthetic files. This ID can be as simple as a file "generation" number incremented on each write or crypto strong checksum. As someone (Terje Mathiesen?) said all programming is an exercise in caching.