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

Similar documents
NFS. CSE/ISE 311: Systems Administra5on

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

NFS. Don Porter CSE 506

Network File System (NFS)

CSE506: Operating Systems CSE 506: Operating Systems

CSE506: Operating Systems CSE 506: Operating Systems

1/10/16. RPC and Clocks. Tom Anderson. Last Time. Synchroniza>on RPC. Lab 1 RPC

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

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

Announcements. Persistence: Log-Structured FS (LFS)

Ext3/4 file systems. Don Porter CSE 506

Distributed File Systems

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

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

DISTRIBUTED FILE SYSTEMS & NFS

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

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

File System Consistency

Distributed Systems. Communica3on and models. Rik Sarkar Spring University of Edinburgh

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

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

Operating Systems. File Systems. Thomas Ropars.

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

What is a file system

Distributed Systems. Communica3on and models. Rik Sarkar 2015/2016. University of Edinburgh

Lesson 9 Transcript: Backup and Recovery

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

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

CS510 Operating System Foundations. Jonathan Walpole

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

Announcements. Persistence: Crash Consistency

File Systems: Consistency Issues

2. PICTURE: Cut and paste from paper

EECS 482 Introduction to Operating Systems

Network File Systems

Main Points. File systems. Storage hardware characteris7cs. File system usage Useful abstrac7ons on top of physical devices

Crash Consistency: FSCK and Journaling. Dongkun Shin, SKKU

Introduc)on to Computer Networks

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

Caching and Demand- Paged Virtual Memory

Re#ring Your Old Computer. Created by Sherry Surdam

COS 318: Operating Systems. Journaling, NFS and WAFL

Block Device Scheduling. Don Porter CSE 506

Block Device Scheduling

Problem Overhead File containing the path must be read, and then the path must be parsed and followed to find the actual I-node. o Might require many

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

Opera&ng Systems: Principles and Prac&ce. Tom Anderson

Operating Systems. Operating Systems Professor Sina Meraji U of T

Virtual File System. Don Porter CSE 306

The Art and Science of Memory Alloca4on

CS 318 Principles of Operating Systems

Lecture 18: Reliable Storage

Chapter 7: File-System

CSE506: Operating Systems CSE 506: Operating Systems

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 32: Pipeline Parallelism 3

1 / 22. CS 135: File Systems. General Filesystem Design

Network File System (NFS)

Network File System (NFS)

OPERATING SYSTEM. Chapter 12: File System Implementation

hashfs Applying Hashing to Op2mize File Systems for Small File Reads

Journaling and Log-structured file systems

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

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

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

CSE 486/586: Distributed Systems

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

[537] Journaling. Tyler Harter

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

Operating Systems, Fall

FS Consistency & Journaling

Virtual File System. Don Porter CSE 506

Disks: Structure and Scheduling

CS Final Exam. Stanford University Computer Science Department. June 5, 2012 !!!!! SKIP 15 POINTS WORTH OF QUESTIONS.!!!!!

GFS: The Google File System

[537] Fast File System. Tyler Harter

CS122 Lecture 15 Winter Term,

File systems: management 1

Operating Systems CMPSC 473 File System Implementation April 10, Lecture 21 Instructor: Trent Jaeger

Name: Instructions. Problem 1 : Short answer. [48 points] CMU / Storage Systems 20 April 2011 Spring 2011 Exam 2

CS 318 Principles of Operating Systems

Concurrent systems Lecture 7: Crash recovery, lock- free programming, and transac<onal memory. Dr Robert N. M. Watson

NFS Design Goals. Network File System - NFS

16 Sharing Main Memory Segmentation and Paging

CISC327 - So*ware Quality Assurance

Administrative Details. CS 140 Final Review Session. Pre-Midterm. Plan For Today. Disks + I/O. Pre-Midterm, cont.

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

Chapter 11: Implementing File Systems

Lecture 7: Distributed File Systems

CS 111. Operating Systems Peter Reiher

CISC327 - So*ware Quality Assurance

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

CSE506: Operating Systems CSE 506: Operating Systems

Remote Procedure Call (RPC) and Transparency

W4118 Operating Systems. Instructor: Junfeng Yang

SCSI overview. SCSI domain consists of devices and an SDS

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

Opera&ng Systems ECE344

Chapter 11: Implementing File

Chapter 11: Implementing File Systems

Paxos provides a highly available, redundant log of events

Transcription:

NFS Overview Sharing files is useful Network file systems give users seamless integra>on of a shared file system with the local file system Many op>ons: NFS, SMB/CIFS, AFS, etc. Security an important considera>on Big picture (from Sandberg et al.) Intui>on Instead of transla>ng 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 mul>ple clients accessing same file? Security New failure modes for applica>ons Goal: Invent VFS to avoid changing applica>ons; use network file system transparently Disconnec>on 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 a\er 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? 1

Stateful protocols A stateful protocol has server state that persists across requests (aka connec>ons) Like the example on previous slide Server Challenges: Knowing when a connec>on has failed (>meout) Tracking state that needs to be cleaned up on a failure Client Challenges: If the server thinks we failed (>meout), recrea>ng server state to make progress Stateless protocol The (poten>ally) simpler alterna>ve: All necessary state is sent with a single request Server implementa>on much simpler! Downside: May introduce more complicated messages And more messages in general Intui>on: 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 creden>als (for security checking) File iden>fier and offset Each protocol- level request needs to match VFS- level opera>on 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 >me? 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 mul>ple >mes 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, preven>ng 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! Genera>on numbers Each >me an inode in NFS is recycled, its genera>on number is incremented Client requests include an inode + genera>on number Detect agempts to access an old inode 2

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 Ac>ve Directory Root squashing: if you access a file as root, you get mapped to a bogus user (nobody) Is this effec>ve security to prevent someone with root on another machine from gejng access to my files? 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 dele>ng it.nfs* files in modern NFS When file is closed, then delete the file If client crashes, there is a garbage file le\ 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 applica>ons Time synchroniza>on Each CPU s clock >cks at slightly different rates These clocks can dri\ over >me Tools like make use modifica>on >mestamps to tell what changed since the last compile In the event of too much dri\ between a client and server, make can misbehave (tries not to) In prac>ce, most systems sharing an NFS server also run network >me protocol (NTP) to same >me 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 sequen>al 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? 3

Consistency Trade- off between performance and consistency Performance: buffer everything, write back when convenient Other clients can see old data, or make conflic>ng 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 en>re file from server into local cache Can definitely have weirdness when two clients touch the same file Reasonable compromise between performance and consistency NFS Evolu>on Basic, working design: NFS v2 Version 3 (1995): 64- bit file sizes and offsets (large file support) Bundle file agributes with other requests to eliminate more stats Other op>miza>ons S>ll widely used today NFS V4 (2000) Agempts to address many of the problems of V3 Security (eliminate homogeneous uid assump>ons) Performance Becomes a stateful prototocol pnfs proposed extensions for parallel, distributed file accesses Slow adop>on NFS Server Configura>on Fairly easy: just add entries to /etc/exports /filer 130.245.153.4(rw,async,root_squash,subtree_check) Export folder /filer To IP address 130.245.153.4 With op>ons: Read + write, asynchronous writes Squash any writes that claim to come from user 0 (root) And add extra checks that all client requests are under / filer Client Configura>on Just like any file system, configured in /etc/fstab Local FS: UUID=f874ae7f- 2bd5-45dd- 8921-400936352440 / ext4 errors=remount- ro 0 1 NFS: camilla:/data/filer /filer nfs tcp,vers=3,noa>me,nodira>me,noacl,retry=3 0 0 4

Other Client Configura>on Op>ons What happens when the server is disconnected? Hard: Hang the system un>l the server comes back up So\: Return an error noa>me: By default, Unix propagates access >mes to all root directories even on a read Only required by a small number of programs Very expensive, o\en disabled Summary NFS is s>ll widely used, in part because it is simple and well- understood Even if not as robust as its compe>tors You should understand architecture and key trade- offs Basics of NFS protocol from paper 5