Network File System (NFS) Brad Karp UCL Computer Science CS GZ03 / M030 6 th, 7 th October, 2008.

Slides:



Advertisements
Similar presentations
Two phase commit. Failures in a distributed system Consistency requires agreement among multiple servers –Is transaction X committed? –Have all servers.
Advertisements

DESIGN AND IMPLEMENTATION OF THE SUN NETWORK FILESYSTEM R. Sandberg, D. Goldberg S. Kleinman, D. Walsh, R. Lyon Sun Microsystems.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Fall 2003 URL: Distributed System Architectures.
Distributed Filesystems: NFS and GFS Costin Raiciu Advanced Topics in Distributed Systems 18 th October, 2011 Slides courtesy of Brad Karp (UCL) and Robert.
The Zebra Striped Network File System Presentation by Joseph Thompson.
Distributed Storage March 12, Distributed Storage What is Distributed Storage?  Simple answer: Storage that can be shared throughout a network.
1 UNIX Internals – the New Frontiers Distributed File Systems.
CS-550: Distributed File Systems [SiS]1 Resource Management in Distributed Systems: Distributed File Systems.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
Design and Implementation of the Sun Network File System Russel Sandberg, David Goldberg, Steve Kleiman, Dan Walsh, and Bob Lyon Appears in USENIX Annual.
L-7 RPC 1. Last Lecture Important Lessons - Naming Naming is a powerful tool in system design  A layer of indirection can solve many problems Name+context.
Distributed Systems 2006 Styles of Client/Server Computing.
Other File Systems: LFS and NFS. 2 Log-Structured File Systems The trend: CPUs are faster, RAM & caches are bigger –So, a lot of reads do not require.
Lecture 4 Remote Procedure Calls (cont). EECE 411: Design of Distributed Software Applications [Last time] Building Distributed Applications: Two Paradigms.
Distributed File System: Design Comparisons II Pei Cao Cisco Systems, Inc.
PRASHANTHI NARAYAN NETTEM.
NFS. The Sun Network File System (NFS) An implementation and a specification of a software system for accessing remote files across LANs. The implementation.
Remote Files. Traditional Memory Interfaces Process Virtual Memory Virtual Memory File Management File Management Physical Memory Physical Memory Storage.
NETWORK FILE SYSTEM (NFS) By Ameeta.Jakate. NFS NFS was introduced in 1985 as a means of providing transparent access to remote file systems. NFS Architecture.
File Systems (2). Readings r Silbershatz et al: 11.8.
DESIGN AND IMPLEMENTATION OF THE SUN NETWORK FILESYSTEM R. Sandberg, D. Goldberg S. Kleinman, D. Walsh, R. Lyon Sun Microsystems.
Distributed File Systems Sarah Diesburg Operating Systems CS 3430.
Sun NFS Distributed File System Presentation by Jeff Graham and David Larsen.
Distributed File Systems Concepts & Overview. Goals and Criteria Goal: present to a user a coherent, efficient, and manageable system for long-term data.
Transactions and Reliability. File system components Disk management Naming Reliability  What are the reliability issues in file systems? Security.
Networked File System CS Introduction to Operating Systems.
Distributed File Systems
Remote Procedure Call (RPC) and Transparency Brad Karp UCL Computer Science CS Z03 / th October, 2006.
Distributed File Systems Overview  A file system is an abstract data type – an abstraction of a storage device.  A distributed file system is available.
What is a Distributed File System?? Allows transparent access to remote files over a network. Examples: Network File System (NFS) by Sun Microsystems.
Background: Operating Systems Brad Karp UCL Computer Science CS GZ03 / M th November, 2008.
1 File Systems: Consistency Issues. 2 File Systems: Consistency Issues File systems maintains many data structures  Free list/bit vector  Directories.
NFS : Network File System SMU CSE8343 Prof. Khalil September 27, 2003 Group 1 Group members: Payal Patel, Malka Samata, Wael Faheem, Hazem Morsy, Poramate.
Eduardo Gutarra Velez. Outline Distributed Filesystems Motivation Google Filesystem Architecture The Metadata Consistency Model File Mutation.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 11-2: File System Implementation Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Remote Procedure Call (RPC) and Transparency Brad Karp UCL Computer Science CS GZ03 / M th October, 2008.
A Low-bandwidth Network File System Athicha Muthitacharoen et al. Presented by Matt Miller September 12, 2002.
Computer Science Lecture 19, page 1 CS677: Distributed OS Last Class: Fault tolerance Reliable communication –One-one communication –One-many communication.
Remote Procedure Call (RPC) and Transparency Brad Karp UCL Computer Science CS GZ03 / nd October, 2007.
Sun Network File System Presentation 3 Group A4 Sean Hudson, Syeda Taib, Manasi Kapadia.
Speculative Execution in a Distributed File System Ed Nightingale Peter Chen Jason Flinn University of Michigan.
GLOBAL EDGE SOFTWERE LTD1 R EMOTE F ILE S HARING - Ardhanareesh Aradhyamath.
Two-Phase Commit Brad Karp UCL Computer Science CS GZ03 / M th October, 2008.
Lecture 24 Sun’s Network File System. PA3 In clkinit.c.
EE324 INTRO TO DISTRIBUTED SYSTEMS. Distributed File System  What is a file system?
Manish Kumar,MSRITSoftware Architecture1 Remote procedure call Client/server architecture.
File Systems 2. 2 File 1 File 2 Disk Blocks File-Allocation Table (FAT)
4P13 Week 9 Talking Points
COT 4600 Operating Systems Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 3:00-4:00 PM.
Review CS File Systems - Partitions What is a hard disk partition?
Distributed File Systems Questions answered in this lecture: Why are distributed file systems useful? What is difficult about distributed file systems?
Speculative Execution in a Distributed File System Ed Nightingale Peter Chen Jason Flinn University of Michigan Best Paper at SOSP 2005 Modified for CS739.
Chapter Five Distributed file systems. 2 Contents Distributed file system design Distributed file system implementation Trends in distributed file systems.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Computer Science Lecture 19, page 1 CS677: Distributed OS Last Class: Fault tolerance Reliable communication –One-one communication –One-many communication.
DISTRIBUTED FILE SYSTEM- ENHANCEMENT AND FURTHER DEVELOPMENT BY:- PALLAWI(10BIT0033)
Jonathan Walpole Computer Science Portland State University
Lecture 22 Sun’s Network File System
File System Implementation
Nache: Design and Implementation of a Caching Proxy for NFSv4
Nache: Design and Implementation of a Caching Proxy for NFSv4
Distributed File Systems
Distributed File Systems
DESIGN AND IMPLEMENTATION OF THE SUN NETWORK FILESYSTEM
Distributed File Systems
CSE 451 Fall 2003 Section 11/20/2003.
Chapter 15: File System Internals
Today: Distributed File Systems
Distributed File Systems
Distributed File Systems
Presentation transcript:

Network File System (NFS) Brad Karp UCL Computer Science CS GZ03 / M030 6 th, 7 th October, 2008

2 NFS Is Relevant Original paper from 1985 Very successful, still widely used today Early result; much subsequent research in networked filesystems “fixing shortcomings of NFS” NFS is a great substrate for cool distributed systems DCNDS projects!

3 Why Build NFS? Why not just store your files on local disk? Sharing data: many users reading/writing same files (e.g., code repository), but running on separate machines Manageability: ease of backing up one server Disks may be expensive (true when NFS built; no longer true) Displays may be expensive (true when NFS built; no longer true)

4 Goals for NFS Work with existing, unmodified apps: –Same semantics as local UNIX filesystem Easily deployed –Easy to add to existing UNIX systems Compatible with non-UNIX OSes –Wire protocol cannot be too UNIX-specific Efficient “enough” –Needn’t offer same performance as local UNIX filesystem Ambitious, conflicting goals! Does NFS achieve them all fully? Hint: Recall “New Jersey” approach

5 NFS Architecture Server (w/disk) Clients LAN App1App2 User Kernel Filesystem syscalls RPCs

6 Simple Example: Reading a File What RPCs would we expect for: fd = open(“f”, 0); read(fd, buf, 8192); close(fd);

7 Simple Example: NFS RPCs for Reading a File Where are RPCs for close()?

8 File Handle: Function and Contents 32-byte name, opaque to client Identifies object on remote server Must be included in all NFS RPCs File handle contains: –filesystem ID –i-number (essentially, physical block ID on disk) –generation number

9 Generation Number: Motivation Client 1 opens file Client 2 opens same file Client 1 deletes the file, creates new one UNIX local filesystem semantics: –Client 2 (App 2) sees old file In NFS, suppose server re-uses i-node –Same i-number for new file as old –RPCs from client 2 refer to new file’s i-number –Client 2 sees new file!

10 Generation Number: Solution Each time server frees i-node, increments its generation number –Client 2’s RPCs now use old file handle –Server can distinguish requests for old vs. new file Semantics still not same as local UNIX fs! –Apps 1 and 2 sharing local fs: client 2 will see old file –Clients 1 and 2 on different workstations sharing NFS fs: client 2 gets error “stale file handle” Trade precise UNIX fs semantics for simplicity New Jersey approach…

11 Why i-numbers, not Filenames? Local UNIX fs: client 1 reads dir2/f NFS with pathnames: client 1 reads dir1/f Concurrent access by clients can change object referred to by filename –Why not a problem in local UNIX fs? i-number refers to actual object, not filename

12 Where Does Client Learn File Handles? Before READ, client obtains file handle using LOOKUP or CREATE Client stores returned file handle in vnode Client’s file descriptor refers to vnode Where does client get very first file handle?

13 NFS Implementation Layering Why not just send syscalls over wire? UNIX semantics defined in terms of files, not just filenames: file’s identity is i-number on disk Even after rename, all these refer to same object as before: –File descriptor –Home directory –Cache contents vnode’s purpose: remember file handles!

14 Example: Creating a File over NFS Suppose client does: fd = creat(“d/f”, 0666); write(fd, “foo”, 3); close(fd); RPCs sent by client: –newfh = LOOKUP (fh, “d”) –filefh = CREATE (newfh, “f”, 0666) –WRITE (filefh, 0, 3, “foo”)

15 Server Crashes and Robustness Suppose server crashes and reboots Will client requests still work? –Will client’s file handles still make sense? –Yes! File handle is disk address of i-node What if server crashes just after client sends an RPC? –Before server replies: client doesn’t get reply, retries What if server crashes just after replying to WRITE RPC?

16 WRITE RPCs and Crash Robustness What must server do to ensure correct behavior when crash after WRITE from client? Client’s data safe on disk i-node with new block number and new length safe on disk Indirect block safe on disk Three writes, three seeks: 45 ms 22 WRITEs/s, so 180 KB/s

17 WRITEs and Throughput Design for higher write throughput: –Client writes entire file sequentially at Ethernet speed (few MB/s) –Update inode, &c. afterwards Why doesn’t NFS use this approach? –What happens if server crashes and reboots? –Does client believe write completed? Improved in NFSv3: WRITEs async, COMMIT on close()

18 Client Caches in NFS Server caches disk blocks Client caches file content blocks, some clean, some dirty Client caches file attributes Client caches name-to-file-handle mappings Client caches directory contents General concern: what if client A caches data, but client B changes it?

19 Multi-Client Consistency Real-world examples of data cached on one host, changed on another: –Save in emacs on one host, “make” on other host –“make” on one host, run program on other host (No problem if users all run on one workstation, or don’t share files)

20 Consistency Protocol: First Try On every read(), client asks server whether file has changed –if not, use cached data for file –if so, issue READ RPCs to get fresh data from server Is this protocol sufficient to make each read() see latest write()? What’s effect on performance? Do we need such strong consistency?

21 Compromise: Close-to-Open Consistency Implemented by most NFS clients Contract: –if client A write()s a file, then close()s it, –then client B open()s the file, and read()s it, –client B’s reads will reflect client A’s writes Benefit: clients need only contact server during open() and close()—not on every read() and write()

22 Compromise: Close-to-Open Consistency Fixes “emacs save, then make” example… …so long as user waits until emacs says it’s done saving file!

23 Close-to-Open Implementation FreeBSD UNIX client (not part of protocol spec): –Client keeps file mtime and size for each cached file block –close() starts WRITEs for all file’s dirty blocks –close() waits for all of server’s replies to those WRITEs –open() always sends GETATTR to check file’s mtime and size, caches file attributes –read() uses cached blocks only if mtime/length have not changed –client checks cached directory contents with GETATTR and ctime

24 Name Caching in Practice Name-to-file-handle cache not always checked for consistency on each LOOKUP –If file deleted, may get “stale file handle” error from server –If file renamed and new file created with same name, may even get wrong file’s contents

25 NFS: Secure? What prevents unauthorized users from issuing RPCs to an NFS server? –e.g., remove files, overwrite data, &c. What prevents unauthorized users from forging NFS replies to an NFS client? –e.g., return data other than on real server IP-address-based authentication of mount requests weak at best; no auth of server to client Security not a first-order goal in original NFS

26 Limitations of NFS Security: what if untrusted users can be root on client machines? Scalability: how many clients can share one server? –Writes always go through to server –Some writes are to “private,” unshared files that are deleted soon after creation Can you run NFS on a large, complex network? –Effects of latency? Packet loss? Bottlenecks? Despite its limitations, NFS a huge success: Simple enough to build for many OSes Correct enough and performs well enough to be practically useful in deployment