In NFSv2 the main goal in the design of the protocol was simple and fast server

In nfsv2 the main goal in the design of the protocol

This preview shows page 3 - 5 out of 16 pages.

In NFSv2, the main goal in the design of the protocol was simple and fast server crash recovery . In a multiple-client, single-server environment, this goal makes a great deal of sense; any minute that the server is down (or unavailable) makes all the client machines (and their users) unhappy and unproductive. Thus, as the server goes, so goes the entire system. c circlecopyrt 2014, A RPACI -D USSEAU T HREE E ASY P IECES
Image of page 3
4 S UN S N ETWORK F ILE S YSTEM (NFS) 48.4 Key To Fast Crash Recovery: Statelessness This simple goal is realized in NFSv2 by designing what we refer to as a stateless protocol. The server, by design, does not keep track of any- thing about what is happening at each client. For example, the server does not know which clients are caching which blocks, or which files are currently open at each client, or the current file pointer position for a file, etc. Simply put, the server does not track anything about what clients are doing; rather, the protocol is designed to deliver in each protocol request all the information that is needed in order to complete the request. If it doesn’t now, this stateless approach will make more sense as we discuss the protocol in more detail below. For an example of a stateful (not stateless) protocol, consider the open() system call. Given a pathname, open() returns a file descriptor (an inte- ger). This descriptor is used on subsequent read() or write() requests to access various file blocks, as in this application code (note that proper error checking of the system calls is omitted for space reasons): char buffer[MAX]; int fd = open("foo", O_RDONLY); // get descriptor "fd" read(fd, buffer, MAX); // read MAX bytes from foo (via fd) read(fd, buffer, MAX); // read MAX bytes from foo ... read(fd, buffer, MAX); // read MAX bytes from foo close(fd); // close file Figure 48.3: Client Code: Reading From A File Now imagine that the client-side file system opens the file by sending a protocol message to the server saying “open the file ’foo’ and give me back a descriptor”. The file server then opens the file locally on its side and sends the descriptor back to the client. On subsequent reads, the client application uses that descriptor to call the read() system call; the client-side file system then passes the descriptor in a message to the file server, saying “read some bytes from the file that is referred to by the descriptor I am passing you here”. In this example, the file descriptor is a piece of shared state between the client and the server (Ousterhout calls this distributed state [O91]). Shared state, as we hinted above, complicates crash recovery. Imagine the server crashes after the first read completes, but before the client has issued the second one. After the server is up and running again, the client then issues the second read. Unfortunately, the server has no idea to which file fd is referring; that information was ephemeral (i.e., in memory) and thus lost when the server crashed. To handle this situa- tion, the client and server would have to engage in some kind of recovery protocol , where the client would make sure to keep enough information
Image of page 4
Image of page 5

You've reached the end of your free preview.

Want to read all 16 pages?

  • Fall '14
  • Client-server, NFS

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes