From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,2d717934f08f5df8 X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1994-05-23 15:25:02 PST Path: bga.com!news.sprintlink.net!hookup!swrinde!cs.utexas.edu!convex!news.duke.edu!godot.cc.duq.edu!nntp.club.cc.cmu.edu!honeydew.srv.cs.cmu.edu!bb3.andrew.cmu.edu!andrew.cmu.edu!postman+ From: Bruce_Leverett@transarc.com Newsgroups: comp.unix.osf.misc Subject: Re: DFS / cache manager- Questions Date: Mon, 23 May 1994 17:23:37 -0400 Organization: Carnegie Mellon, Pittsburgh, PA Message-ID: References: NNTP-Posting-Host: po3.andrew.cmu.edu In-Reply-To: Although Craig Everhart has already posted an answer to your questions, I'm going to post another one. It goes into more detail than Craig's answer and so it is possible that I will only cause confusion. But, try it anyhow. There are several different, independent, timeouts involved. At least one of them can be adjusted by a system administrator. >Could anyone answer the following questions about the DFS Cache Manager ? > >Let's consider a very simple configuration with one Client system and one >Security/CDS/DFS Server system only. > >1. How is the cache manager supposed to behave when the server goes down? >How long does it keep data locally and allow cached files to be read by an >application on the client? > If the client doesn't try to modify any data, it can continue to read the data until its tokens expire. The token expiration time can be adjusted by an administrator. The default is 2 hours. The administrator cannot set a value less than 20 minutes. By "read the data" I mean using the read (or write) system call, or causing a page fault in VM that is mapped to the file. It is important to note that if the application doesn't have to do these things, either because it uses large buffers for the read and write system calls, or because the client's VM manager does not invalidate its VM, the application won't notice when the tokens expire. >2. What should happen if a user (on the client ) wants to WRITE out a file >after the server has gone down ? The commands 'cm lsstores/cm resetstores' >make me think that the cache manager keeps the modified data in the cache >and attempt to contact the server, I suppose during a limited period of >time. Is it the same time-out as in question 1) ? > If the file is already in the cache and the client has an unexpired token for it, the write system call will not cause any immediate attempt to contact the server. Hence the write system call may succeed (return a value equal to the number of bytes that the caller asked to write). Eventually the client will attempt to write data to the server. This may happen on various occasions: - An application may fsync the file. - An application may close the file. - An administrator may use the "cm flush" or "cm flushfileset" commands. - The cache manager may try to write the data in order to reclaim system resources. - If none of the above happen, a daemon will attempt to write all data every 30 seconds. At this time the cache manager will attempt to contact the server. If it doesn't already know that the server is down, it will find out. It pings all servers every 15 seconds, so it may have found out that the server is down before actually trying to write to it. Eventually the cache manager marks the file descriptor in such a way as to indicate that data cannot be written to the file. From that point forward, write system calls will fail (return -1, setting errno to ETIMEDOUT). Also, the output of the command "cm lsstores" will reflect that there is a file whose data could not be stored. This marking of the file descriptor does not necessarily happen immediately when the cache manager detects a crashed server or a failure to store data, however. It happens only on particular occasions, when the cache manager attempts to write all the file's data: - An application may fsync the file. - An application may close the file. - An administrator may use the "cm flush" command. - If none of the above happen, a daemon will attempt to write the data every 30 seconds. When an application closes a file, unsuccessful attempts to store data to the server will be noted, and the close system call will return an error code. Thus, for an application to detect failures to write data, it should not only check the result of the write system call, but also check the result of the close system call. (The fsync system call will also return an error code.) The daemon will continue to attempt every 30 seconds to store the data back to the server. After 20 minutes, the cache manager may give up, and throw away the unstored data. At that point neither read nor write system calls will succeed (they will return -1, setting errno to ESTALE). The cache manager will not give up, however, as long as any process has the file open. >3. Also in that case, I assume that the user application is informed that >the data cannot be written to the Server. But is the application informed >of the *final* result of the operation ( I mean : whether the cache >manager has or not finally managed to reach the server ) ? After 20 minutes, the application may no longer be running. Even if it is still running, it may no longer have the file open. In either case, the cache manager does not attempt to inform the application of the outcome. If at any time while the file has pending stores, the server comes up and the cache manager succeeds in sending all the data down to it, the file will be marked as no longer having "pending stores". Any applications that are holding the file open, or subsequently open it, will be able to execute write system calls. There is no mechanism to "inform" the application, that is, it is not possible for the application to sleep until the file's status changes. An application may repeatedly execute the fsync system call until it is successful (returns 0); the success indicates that the cache manager has reached the server.