From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Wed, 31 Oct 2007 17:40:28 -0400 From: "Russ Cox" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Re: [9fans] QTCTL? In-Reply-To: <8ccc8ba40710311423n2bab5d66gc91af35a8e17ff60@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <8ccc8ba40710311329g344868dj35c3c245d26b2154@mail.gmail.com> <9a23fe848dbbb94206e2a1edadbedc03@terzarima.net> <8ccc8ba40710311423n2bab5d66gc91af35a8e17ff60@mail.gmail.com> Topicbox-Message-UUID: e24a09f8-ead2-11e9-9d60-3106f5b1d025 > But I assume that when you > echo a > f > cat f > would yield > a > and I expect a file with reported size "0" to have 0 bytes on it when rea= d. > > That=B4s (file) decency for me. But this isn't even true for disk files if someone else or some other machine is writing to f around the same time. If I'm doing tail -f on a remote log file and tail -f just does occasional reads at the end of the file, then you will get the wrong answer, because once the cache sees the eof it will never issue another read. It is a fundamental problem with implementing caching atop a system that is not intended to be cached. Having a QTCTL bit (or a QTOKTOCACHE bit) will not solve the problem. Cfs is not magic. It trades some of the reliability of 9P for some performance. It doesn't do a perfect job. If you choose to use cfs then you are accepting those degradations in semantics, even for "disk files". 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. (We did add QTAPPEND to fix one glaring cfs bug.) By all means experiment with real caching protocols using 9P. Perhaps you will find a nice way to add it and then 9P2010 can adopt it. QTCTL isn't enough though: it pushes your problems farther away but doesn't solve them. Russ