slide1 l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Membrane: Operating System support for Restartable File Systems PowerPoint Presentation
Download Presentation
Membrane: Operating System support for Restartable File Systems

Loading in 2 Seconds...

play fullscreen
1 / 41
errol

Membrane: Operating System support for Restartable File Systems - PowerPoint PPT Presentation

151 Views
Download Presentation
Membrane: Operating System support for Restartable File Systems
An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Swaminathan Sundararaman, Sriram Subramanian, Abhishek Rajimwale, Andrea C. Arpaci-Dusseau, Remzi H. Arpaci-Dusseau, Michael M. Swift Membrane Bug Membrane: Operating System support for Restartable File Systems Membrane is a layer of material which serves as a selective barrier between two phases and remains impermeable to specific particles, molecules, or substances when exposed to the action of a driving force. File System Kernel

  2. Bugs in File-system Code • Bugs are common in any large software • File systems contain 1,000 – 100,000 loc • Recent work has uncovered 100s of bugs [Engler OSDI ’00, Musuvathi OSDI ’02, Prabhakaran SOSP ‘03, Yang OSDI ’04, Gunawi FAST ‘08, Rubio-Gonzales PLDI ’09] • Error handling code, recovery code, etc. • File systems are part of core kernel • A single bug could make the kernel unusable Membrane: Operating System Support for Restartable File Systems (FAST '10)

  3. Bug Detection in File Systems • FS developers are good at detecting bugs • “Paranoid” about failures • Lots of checks all over the file system code! Number of calls to assert, BUG, and panic in Linux 2.6.27 Detection is easybut recovery is hard Membrane: Operating System Support for Restartable File Systems (FAST '10)

  4. Why is Recovery Hard? App App App App i_count 0x00002 VFS Inode VFS Crash Address mapping File System File System File systems manage their own in-memory objects Processes could potentially use corrupt in-memory file-system objects Process killed on crash Inconsistent kernel state Hard to free FS objects No fault isolation Common solution:crash file system and hope problem goes away after OS reboot Membrane: Operating System Support for Restartable File Systems (FAST '10)

  5. Why not Fix Source Code? • To develop perfect file systems • Tools do not uncover all file system bugs • Bugs still are fixed manually • Code constantly modified due to new features • Make file systems handle all error cases • Interacts with many external components • VFS, memory mgmt., network, page cache, and I/O Cope with bugs than hope to avoid them Membrane: Operating System Support for Restartable File Systems (FAST '10)

  6. Restartable File Systems • Membrane: OS framework to support lightweight, stateful recovery from FS crashes • Upon failure transparently restart FS • Restore state and allow pending application requests to be serviced • Applications oblivious to crashes • A generic solution to handle all FS crashes • Last resort before file systems decide to give up Membrane: Operating System Support for Restartable File Systems (FAST '10)

  7. Results • Implemented Membrane in Linux 2.6.15 • Evaluated with ext2, VFAT, and ext3 • Evaluation • Transparency: hide failures (~50 faults) from appl. • Performance:< 3% for micro & macro benchmarks • Recovery time:< 30 milliseconds to restart FS • Generality: < 5 lines of code for each FS Membrane: Operating System Support for Restartable File Systems (FAST '10)

  8. Outline • Motivation • Restartable file systems • Evaluation • Conclusions Membrane: Operating System Support for Restartable File Systems (FAST '10)

  9. Components of Membrane • Fault Detection • Helps detect faults quickly • Fault Anticipation • Records file-system state • Fault Recovery • Executes recovery protocol to cleanup and restart the failed file system Fault Anticipation Membrane Fault Recovery Fault Detection Membrane: Operating System Support for Restartable File Systems (FAST '10)

  10. Fault Detection • Correct recovery requires early detection • Membrane best handles “fail-stop” failures • Both hardware and software-based detection • H/W: null pointer, general protection error, ... • S/W: asserts(), BUG(), BUG_ON(), panic() • Assume transient faults during recovery • Non-transient faults: return error to that process Membrane: Operating System Support for Restartable File Systems (FAST '10)

  11. Components of Membrane Fault Anticipation Membrane Fault Recovery Fault Detection Membrane: Operating System Support for Restartable File Systems (FAST '10)

  12. Fault Anticipation Additional work done in anticipation of a failure • Issue: where to restart the file system from? • File systems constantly updated by applications • Possible solutions: • Make each operation atomic • Leverage in-built crash consistency mechanism • Not all FS have crash consistency mechanism Generic mechanism to checkpoint FS state Membrane: Operating System Support for Restartable File Systems (FAST '10)

  13. Checkpoint File-system State Checkpoint: consistent state of the file system that can be safely rolled back to in the event of a crash App App App All requests enter via VFS layer VFS Control requests to FS & dirty pages to disk File System ext3 VFAT File systems write to disk through page cache Page Cache Disk Membrane: Operating System Support for Restartable File Systems (FAST '10)

  14. Generic COW based Checkpoint App App App VFS VFS VFS Disk Disk Disk File System File System File System ✓ ✓ ✓ ✓ Page Cache Page Cache Page Cache Consistent Image #1 Consistent Image #2 Consistent Image #3 ✓ Consistent image Can be written back to disk STOP Disk Disk Disk STOP STOP On crash roll back to last consistent Image Copy-on-Write During Checkpoint After Checkpoint Regular Membrane Membrane: Operating System Support for Restartable File Systems (FAST '10)

  15. State after checkpoint? App • On crash: flush dirty pages of last checkpoint • Throw away the in-memory state • Remount from the last checkpoint • Consistent file-system image on disk • Issue: state after checkpoint would be lost • Operations completed after checkpoint returned back to applications VFS File System Crash Page Cache ✓ ✓ ✓ ✓ STOP Disk Need to recreate state after checkpoint On Crash After Recovery Membrane: Operating System Support for Restartable File Systems (FAST '10)

  16. Operation-level Logging • Log operations along with their return value • Replay completed operations after checkpoint • Operations are logged at the VFS layer • File-system independent approach • Logs are maintained in-memory and not on disk • How long should we keep the log records? • Log thrown away at checkpoint completion Membrane: Operating System Support for Restartable File Systems (FAST '10)

  17. Components of Membrane Fault Anticipation Membrane Fault Recovery Fault Detection Membrane: Operating System Support for Restartable File Systems (FAST '10)

  18. Fault Recovery Important steps in recovery: • Cleanup state of partially-completed operations • Cleanup in-memory state of file system • Remount file system from last checkpoint • Replay completed operations after checkpoint • Re-execute partially complete operations Membrane: Operating System Support for Restartable File Systems (FAST '10)

  19. Partially completed Operations Multiple threads inside file system Intertwined execution User App App App App VFS File System VFS Crash File System File System Kernel FS code should not be trusted after crash Page Cache Application threads killed? - application state will be lost Processes cannot be killed after crash Clean way to undo incomplete operations Membrane: Operating System Support for Restartable File Systems (FAST '10)

  20. A Skip/Trust Unwind Protocol Skip: file-system code Trust: kernel code (VFS, memory mgmt., …) - Cleanup state on error from file systems • How to prevent execution of FS code? • Control capture mechanism: marks file-system code pages as non-executable • Unwind Stack: stores return address (of last kernel function) along with expected error value Membrane: Operating System Support for Restartable File Systems (FAST '10)

  21. Skip/Trust Unwind Protocol in Action • E.g., create code path in ext2 2 3 sys_open() 3 Release namei data 1 2 1 Release fd do_sys_open() filp_open() Clear buffer Zero page Mark not dirty open_namei() vfs_create() -ENOMEM ext2_create() ext2_create() ext2_addlink() fn fn vfs_create blk..._write membrane fault ext2_prepare_write() rax rax rbp rbp rsi rsi -EIO regs regs rdi rdi rbx rbx rcx rcx block_prepare_write() rdx rdx r8 r8 … … membrane fault ext2_get_block() ext2_get_block() Crash rval rval Unwind Stack -ENOMEM -EIO Kernel is restored to a consistent state Kernel File system Non-executable Membrane: Operating System Support for Restartable File Systems (FAST '10)

  22. Components of Membrane Fault Anticipation Membrane Fault Recovery Fault Detection Membrane: Operating System Support for Restartable File Systems (FAST '10)

  23. Putting All Pieces Together 5 3 Periodically create checkpoints Open (“file”) write() read() write() link() Close() 1 Application File System Crash 2 VFS 6 Unwind in-flight processes 3 checkpoint File System 2 Move to recent checkpoint 4 4 1 T0 T1 T2 Replay completed operations 5 time Re-execute unwound process Legend: Completed In-progress Crash 6 Membrane: Operating System Support for Restartable File Systems (FAST '10)

  24. Outline • Motivation • Restartable file systems • Evaluation • Conclusions Membrane: Operating System Support for Restartable File Systems (FAST '10)

  25. Evaluation • Questions that we want to answer: • Can membrane hide failures from applications? • What is the overhead during user workloads? • Portability of existing FS to work with Membrane? • How much time does it take to recover the FS? • Setup: • 2.2 GHz Opteron processor & 2 GB RAM • Two 80 GB western digital disk • Linux 2.6.15 64bit kernel, 5.5K LOC were added • File systems: ext2, VFAT, ext3 Membrane: Operating System Support for Restartable File Systems (FAST '10)

  26. How Transparent are Failures? Membrane successfully hides faults Legend: O – oops, G- prot. fault, d – detected, o – cannot unmount, ✗ - no, ✓- yes Membrane: Operating System Support for Restartable File Systems (FAST '10)

  27. Overheads during User Workloads? Workload: Copy, untar, make of OpenSSH 4.51 Time in Seconds Membrane: Operating System Support for Restartable File Systems (FAST '10)

  28. Overheads during User Workloads? Workload: Copy, untar, make of OpenSSH 4.51 2.3% 1.4% 1.4% 30.8 30.1 29.1 28.9 28.7 28.5 Reliability almost comes for free Time in Seconds Membrane: Operating System Support for Restartable File Systems (FAST '10)

  29. Generality of Membrane? No crash-consistency crash-consistency Individual file system changes • Existing code remains unchanged Additions: track allocations and write super block Minimal changes to port existing FS to Membrane Membrane: Operating System Support for Restartable File Systems (FAST '10)

  30. Outline • Motivation • Restartable file systems • Evaluation • Conclusions Membrane: Operating System Support for Restartable File Systems (FAST '10)

  31. Conclusions • Failures are inevitable in file systems • Learn to cope and not hope to avoid them • Membrane: Generic recovery mechanism • Users: Build trust in new file systems (e.g., btrfs) • Developers: Quick-fix bug patching • Encourage more integrity checks in FS code • Detection is easy but recovery is hard Membrane: Operating System Support for Restartable File Systems (FAST '10)

  32. Thank You! Questions? Advanced Systems Lab (ADSL) University of Wisconsin-Madison http://www.cs.wisc.edu/adsl Membrane: Operating System Support for Restartable File Systems (FAST '10)

  33. Are Failures Always Transparent? • Files may be recreated during recovery • Inode numbers could change after restart Solution: make create() part of a checkpoint Inode# Mismatch File1: inode# 15 File1: inode# 12 create (“file1”) stat (“file1”) write (“file1”, 4k) create (“file1”) write (“file1”, 4k) stat (“file1”) Application VFS File System File : file1 Inode# : 12 File : file1 Inode# : 15 Epoch 0 Epoch 0 After Crash Recovery Before Crash Membrane: Operating System Support for Restartable File Systems (FAST '10)

  34. Postmark Benchmark • 3000 files (sizes 4K to 4MB), 60K transactions 1.2% 484.1 478.2 Time in Seconds 0.6% 1.6% 46.9 47.2 43.8 43.1 Membrane: Operating System Support for Restartable File Systems (FAST '10)

  35. Recovery Time • Recovery time is a function of: • Dirty blocks, open sessions, and log records • We varied each of them individually Recovery time is in the order of a few milliseconds Membrane: Operating System Support for Restartable File Systems (FAST '10)

  36. Recovery Time (Cont.) Restart ext2 during random-read benchmark Membrane: Operating System Support for Restartable File Systems (FAST '10)

  37. Generality and Code Complexity Individual file system changes Kernel changes Membrane: Operating System Support for Restartable File Systems (FAST '10)

  38. Interaction with Modern FSes • Have built-in crash consistency mechanism • Journaling or Snapshotting • Seamlessly integrate with these mechanism • Need FSes to indicate beginning and end of an transaction • Works for data and ordered journaling mode • Need to combine writeback mode with COW Membrane: Operating System Support for Restartable File Systems (FAST '10)

  39. Page Stealing Mechanism • Goal: Reduce the overhead of logging writes • Soln: Grab data from page cache during recovery Write (fd, buf, offset, count) VFS VFS VFS File System File System File System Page Cache Page Cache Page Cache Before Crash During Recovery After Recovery Membrane: Operating System Support for Restartable File Systems (FAST '10)

  40. Handling Non-Determinism • During log replay could data be written in different order? • Log entries need not represent actual order • Not a problem for meta-data updates • Only one of them succeed and is recorded in log • Deterministic data-block updates with page stealing mechanism • Latest version of the page is used during replay Membrane: Operating System Support for Restartable File Systems (FAST '10)

  41. Possible Solutions • Code to recover from all failures • Not feasible in reality • Restart on failure • Previous work have taken this approach FS need: stateful & lightweight recovery Lightweight Heavyweight CuriOS EROS Stateful Nooks/Shadow Xen, Minix L4, Nexus SafeDrive Singularity Stateless Membrane: Operating System Support for Restartable File Systems (FAST '10)