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

Similar documents
NFS. Don Porter CSE 506

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

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.

Virtual File System. 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:

VFS, Continued. Don Porter CSE 506

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

Native POSIX Thread Library (NPTL) CSE 506 Don Porter

16 Sharing Main Memory Segmentation and Paging

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

Tricky issues in file systems

Distributed Systems - III

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

Chapter 11: File System Implementation. Objectives

Journaling and Log-structured file systems

File Systems. What do we need to know?

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

CSE502: Computer Architecture CSE 502: Computer Architecture

Transcription:

Big picture (from Sandberg et al.) NFS Don Porter CSE 506 Intuition Challenges 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? 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 1

Disconnection Stateful protocols 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? 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 NFS is stateless 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 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 How do you know when something changes on the server? 2

Challenge 1: Lost request? Challenge 2: Inode reuse 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 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 Security 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 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? 3

File locking Removal of open files 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 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 Time synchronization 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 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 4

Cached writes Caches and consistency 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 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 Close-to-open 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 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 5

Other optimizations NFS Evolution 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 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) Summary 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 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 Slow adoption 6