NFS. Don Porter CSE 506

Similar documents
ò Server can crash or be disconnected ò Client can crash or be disconnected ò How to coordinate multiple clients accessing same file?

NFS 3/25/14. Overview. Intui>on. Disconnec>on. Challenges

NFS. CSE/ISE 311: Systems Administra5on

Network File System (NFS)

CSE506: Operating Systems CSE 506: Operating Systems

CSE506: Operating Systems CSE 506: Operating Systems

NFS: Naming indirection, abstraction. Abstraction, abstraction, abstraction! Network File Systems: Naming, cache control, consistency

Ext3/4 file systems. Don Porter CSE 506

416 Distributed Systems. Distributed File Systems 2 Jan 20, 2016

DISTRIBUTED FILE SYSTEMS & NFS

ò Very reliable, best-of-breed traditional file system design ò Much like the JOS file system you are building now

Topics. File Buffer Cache for Performance. What to Cache? COS 318: Operating Systems. File Performance and Reliability

What is a file system

Example File Systems Using Replication CS 188 Distributed Systems February 10, 2015

Background. 20: Distributed File Systems. DFS Structure. Naming and Transparency. Naming Structures. Naming Schemes Three Main Approaches

File System Consistency. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

416 Distributed Systems. Distributed File Systems 1: NFS Sep 18, 2018

File System Consistency

Network File Systems

Distributed Systems. Lec 9: Distributed File Systems NFS, AFS. Slide acks: Dave Andersen

Distributed Systems. Hajussüsteemid MTAT Distributed File Systems. (slides: adopted from Meelis Roos DS12 course) 1/15

Lesson 9 Transcript: Backup and Recovery

Announcements. Persistence: Log-Structured FS (LFS)

Distributed File Systems

Stanford University Computer Science Department CS 240 Sample Quiz 2 Questions Winter February 25, 2005

Virtual File System. Don Porter CSE 506

Operating Systems. File Systems. Thomas Ropars.

Crash Consistency: FSCK and Journaling. Dongkun Shin, SKKU

File Systems: Consistency Issues

CS510 Operating System Foundations. Jonathan Walpole

Filesystem. Disclaimer: some slides are adopted from book authors slides with permission

2. PICTURE: Cut and paste from paper

COS 318: Operating Systems. Journaling, NFS and WAFL

Virtual File System. Don Porter CSE 306

(a) Which of these two conditions (high or low) is considered more serious? Justify your answer.

VFS, Continued. Don Porter CSE 506

GFS: The Google File System

Lecture 10: Crash Recovery, Logging

CSE 153 Design of Operating Systems

Chapter 7: File-System

Da-Wei Chang CSIE.NCKU. Professor Hao-Ren Ke, National Chiao Tung University Professor Hsung-Pin Chang, National Chung Hsing University

Filesystem. Disclaimer: some slides are adopted from book authors slides with permission 1

Announcements. Persistence: Crash Consistency

CS 167 Final Exam Solutions

Network File System (NFS)

CSE 486/586: Distributed Systems

Network File System (NFS)

File System Performance (and Abstractions) Kevin Webb Swarthmore College April 5, 2018

RCU. ò Walk through two system calls in some detail. ò Open and read. ò Too much code to cover all FS system calls. ò 3 Cases for a dentry:

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 21: Network Protocols (and 2 Phase Commit)

Stanford University Computer Science Department CS 240 Quiz 2 with Answers Spring May 24, total

Lecture 18: Reliable Storage

CS122 Lecture 15 Winter Term,

Fall 2017 :: CSE 306. File Systems Basics. Nima Honarmand

1 / 23. CS 137: File Systems. General Filesystem Design

EECS 482 Introduction to Operating Systems

CS5412: TRANSACTIONS (I)

SCSI overview. SCSI domain consists of devices and an SDS

Paxos provides a highly available, redundant log of events

Linux kernel synchronization. Don Porter CSE 506

C 1. Recap. CSE 486/586 Distributed Systems Distributed File Systems. Traditional Distributed File Systems. Local File Systems.

Chapter 10: Case Studies. So what happens in a real operating system?

CSE502: Computer Architecture CSE 502: Computer Architecture

CSE506: Operating Systems CSE 506: Operating Systems

16 Sharing Main Memory Segmentation and Paging

Native POSIX Thread Library (NPTL) CSE 506 Don Porter

Announcements. P4: Graded Will resolve all Project grading issues this week P5: File Systems

Tricky issues in file systems

Chapter 11: File System Implementation. Objectives

Distributed Systems - III

Review: FFS [McKusic] basics. Review: FFS background. Basic FFS data structures. FFS disk layout. FFS superblock. Cylinder groups

Access Control Lists. Don Porter CSE 506

File Systems. What do we need to know?

Journaling and Log-structured file systems

6.824 Distributed System Engineering: Spring Quiz I Solutions

File System Interface. ICS332 Operating Systems

Stanford University Computer Science Department CS 240 Sample Quiz 2 Answers Winter February 25, 2005

CSE 410 Final Exam 6/09/09. Suppose we have a memory and a direct-mapped cache with the following characteristics.

Typical File Extensions File Structure

Implementing caches. Example. Client. N. America. Client System + Caches. Asia. Client. Africa. Client. Client. Client. Client. Client.

NFS Design Goals. Network File System - NFS

Block Device Scheduling. Don Porter CSE 506

Review: FFS background

Block Device Scheduling

CS 318 Principles of Operating Systems

RCU. ò Dozens of supported file systems. ò Independent layer from backing storage. ò And, of course, networked file system support

Operating Systems Design Exam 3 Review: Spring Paul Krzyzanowski

CSE 451: Operating Systems Winter Module 17 Journaling File Systems

Distributed File Systems Part II. Distributed File System Implementation

Inside the PostgreSQL Shared Buffer Cache

Lecture 7: Distributed File Systems

Lecture 14: Distributed File Systems. Contents. Basic File Service Architecture. CDK: Chapter 8 TVS: Chapter 11

Shared snapshots. 1 Abstract. 2 Introduction. Mikulas Patocka Red Hat Czech, s.r.o. Purkynova , Brno Czech Republic

Lecture 21: Reliable, High Performance Storage. CSC 469H1F Fall 2006 Angela Demke Brown

COS 318: Operating Systems. NSF, Snapshot, Dedup and Review

Lecture 4: Memory Management & The Programming Interface

COSC 6385 Computer Architecture. Storage Systems

File Systems. Chapter 11, 13 OSPP

CS 318 Principles of Operating Systems

Consistency: Relaxed. SWE 622, Spring 2017 Distributed Software Engineering

Transcription:

NFS Don Porter CSE 506

Big picture (from Sandberg et al.)

Intuition ò Instead of translating VFS requests into hard drive accesses, translate them into remote procedure calls to a server ò Simple, right? I mean, what could possibly go wrong?

Challenges ò Server can crash or be disconnected ò Client can crash or be disconnected ò How to coordinate multiple clients accessing same file? ò Security ò New failure modes for applications ò Goal: Invent VFS to avoid changing applications; use network file system transparently

Disconnection ò Just as a machine can crash between writes to the hard drive, a client can crash between writes to the server ò The server needs to think about how to recover if a client fails between requests ò ò ò ò Ex: Imagine a protocol that just sends low-level disk requests to a distributed virtual disk. What happens if the client goes away after marking a block in use, but before doing anything with it? When is it safe to reclaim the block? What if, 3 months later, the client tries to use the block?

Stateful protocols ò A stateful protocol has server state that persists across requests (aka connections) ò Like the example on previous slide ò Server Challenges: ò Knowing when a connection has failed (timeout) ò Tracking state that needs to be cleaned up on a failure ò Client Challenges: ò If the server thinks we failed (timeout), recreating server state to make progress

Stateless protocol ò The (potentially) simpler alternative: ò ò ò Downside: ò ò All necessary state is sent with a single request Server implementation much simpler! May introduce more complicated messages And more messages in general ò Intuition: A stateless protocol is more like polling, whereas a stateful protocol is more like interrupts ò How do you know when something changes on the server?

NFS is stateless ò Every request sends all needed info ò User credentials (for security checking) ò File identifier and offset ò Each protocol-level request needs to match VFS-level operation for reliability ò E.g., write, delete, stat

Challenge 1: Lost request? ò What if I send a request to the NFS server, and nothing happens for a long time? ò Did the message get lost in the network (UDP)? ò Did the server die? ò Don t want to do things twice, like write data at the end of a file twice ò Idea: make all requests idempotent or having the same effect when executed multiple times ò Ex: write() has an explicit offset, same effect if done 2x

Challenge 2: Inode reuse ò Suppose I open file foo and it maps to inode 30 ò Suppose another process unlinks file foo ò On a local file system, the file handle holds a reference to the inode, preventing reuse ò NFS is stateless, so the server doesn t know I have an open handle ò ò The file can be deleted and the inode reused My request for inode 30 goes to the wrong file! Uh-oh!

Generation numbers ò Each time an inode in NFS is recycled, its generation number is incremented ò Client requests include an inode + generation number ò Detect attempts to access an old inode

Security ò Local uid/gid passed as part of the call ò Uids must match across systems ò Yellow pages (yp) service; evolved to NIS ò Replaced with LDAP or Active Directory ò Root squashing: if you access a file as root, you get mapped to a bogus user (nobody) ò Is this effective security to prevent someone with root on another machine from getting access to my files?

File locking ò I want to be able to change a file without interference from another client. ò I could get a server-side lock ò But what happens if the client dies? ò Lots of options (timeouts, etc), but very fraught ò Punted to a separate, optional locking service

Removal of open files ò Unix allows you to delete an open file, and keep using the file handle; a hassle for NFS ò On the client, check if a file is open before removing it ò If so, rename it instead of deleting it ò.nfs* files in modern NFS ò When file is closed, then delete the file ò If client crashes, there is a garbage file left which must be manually deleted

Changing Permissions ò On Unix/Linux, once you have a file open, a permission change generally won t revoke access ò Permissions cached on file handle, not checked on inode ò Not necessarily true anymore in Linux ò NFS checks permissions on every read/write---introduces new failure modes ò Similarly, you can have issues with an open file being deleted by a second client ò More new failure modes for applications

Time synchronization ò Each CPU s clock ticks at slightly different rates ò These clocks can drift over time ò Tools like make use modification timestamps to tell what changed since the last compile ò In the event of too much drift between a client and server, make can misbehave (tries not to) ò In practice, most systems sharing an NFS server also run network time protocol (NTP) to same time server

Cached writes ò A local file system sees performance benefits from buffering writes in memory ò Rather than immediately sending all writes to disk ò E.g., grouping sequential writes into one request ò Similarly, NFS sees performance benefits from caching writes at the client machine ò E.g., grouping writes into fewer synchronous requests

Caches and consistency ò Suppose clients A and B have a file in their cache ò A writes to the file ò Data stays in A s cache ò Eventually flushed to the server ò B reads the file ò Does B read the old contents or the new file contents?

Consistency ò Trade-off between performance and consistency ò Performance: buffer everything, write back when convenient ò Other clients can see old data, or make conflicting updates ò Consistency: Write everything immediately; immediately detect if another client is trying to write same data ò Much more network traffic, lower performance ò Common case: accessing an unshared file

Close-to-open consistency ò NFS Model: Flush all writes on a close ò When you open, you get the latest version on the server ò Copy entire file from server into local cache ò Can definitely have weirdness when two clients touch the same file ò Reasonable compromise between performance and consistency

Other optimizations ò Caching inode (stat) data and directory entries on the client ended up being a big performance win ò So did read-ahead on the server ò And demand paging on the client

NFS Evolution ò You read about what is basically version 2 ò Version 3 (1995): ò 64-bit file sizes and offsets (large file support) ò Bundle file attributes with other requests to eliminate more stats ò Other optimizations ò Still widely used today

NFS V4 (2000) ò Attempts to address many of the problems of V3 ò Security (eliminate homogeneous uid assumptions) ò Performance ò Becomes a stateful prototocol ò pnfs proposed extensions for parallel, distributed file accesses ò Slow adoption

Summary ò NFS is still widely used, in part because it is simple and well-understood ò Even if not as robust as its competitors ò You should understand architecture and key trade-offs ò Basics of NFS protocol from paper