specifying and checking file system crash consistency
play

Specifying and Checking File System Crash-Consistency Models Steven - PowerPoint PPT Presentation

Specifying and Checking File System Crash-Consistency Models Steven Lang September 4, 2016 Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universitt Mainz Motivation The problem: POSIX


  1. Specifying and Checking File System Crash-Consistency Models Steven Lang September 4, 2016

  2. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Motivation The problem: ◮ POSIX file-system-interfaces do not define possible outcomes of a crash ◮ Can lead to ◮ Corrupt application states ◮ Catastrophic data loss 1 Steven Lang September 4, 2016

  3. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Motivation Replace-Via-Rename Pattern / ∗ " f i l e " has old data ∗ / fd = open ( " f i l e . tmp" ) ; w r i t e ( fd , new , s i z e ) ; c l o s e ( fd ) ; rename ( " f i l e . tmp" , " f i l e " ) ; 2 Steven Lang September 4, 2016

  4. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Motivation Replace-Via-Rename Pattern open / ∗ " f i l e " has old data ∗ / fd = open ( " f i l e . tmp" ) ; write 0 w r i t e ( fd , new , s i z e ) ; c l o s e ( fd ) ; rename ( " f i l e . tmp" , " f i l e " ) ; rename write 1 2 Steven Lang September 4, 2016

  5. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Motivation Replace-Via-Rename Pattern open / ∗ " f i l e " has old data ∗ / fd = open ( " f i l e . tmp" ) ; write 0 w r i t e ( fd , new , s i z e ) ; c l o s e ( fd ) ; rename ( " f i l e . tmp" , " f i l e " ) ; rename write 1 file’s on-disk state possible executions seen on disk new open, write 0 , rename, write 1 , ... 2 Steven Lang September 4, 2016

  6. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Motivation Replace-Via-Rename Pattern open / ∗ " f i l e " has old data ∗ / fd = open ( " f i l e . tmp" ) ; write 0 w r i t e ( fd , new , s i z e ) ; c l o s e ( fd ) ; rename ( " f i l e . tmp" , " f i l e " ) ; rename write 1 file’s on-disk state possible executions seen on disk new open, write 0 , rename, write 1 , ... old open, write 0 , crash 2 Steven Lang September 4, 2016

  7. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Motivation Replace-Via-Rename Pattern open / ∗ " f i l e " has old data ∗ / fd = open ( " f i l e . tmp" ) ; write 0 w r i t e ( fd , new , s i z e ) ; c l o s e ( fd ) ; rename ( " f i l e . tmp" , " f i l e " ) ; rename write 1 file’s on-disk state possible executions seen on disk new open, write 0 , rename, write 1 , ... old open, write 0 , crash empty open, rename, crash 2 Steven Lang September 4, 2016

  8. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Motivation Replace-Via-Rename Pattern open / ∗ " f i l e " has old data ∗ / fd = open ( " f i l e . tmp" ) ; write 0 w r i t e ( fd , new , s i z e ) ; c l o s e ( fd ) ; rename ( " f i l e . tmp" , " f i l e " ) ; rename write 1 file’s on-disk state possible executions seen on disk new open, write 0 , rename, write 1 , ... old open, write 0 , crash empty open, rename, crash partial new open, write 0 , rename, crash 2 Steven Lang September 4, 2016

  9. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Motivation Introduction Background Crash-Consistency Models FERRITE Conclusion Outlook 3 Steven Lang September 4, 2016

  10. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Introduction ◮ Modern file system optimizations relax the order in which operations are executed Good: ◮ Provide significant performance gains Bad: ◮ Invisible to applications ◮ Machine crashes during out-of-order execution can harm the data’s persistence 4 Steven Lang September 4, 2016

  11. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Introduction ◮ Key challenge for application writers: ◮ Understand the behavior of file systems across system crashes ◮ They make assumptions about crash guarantees provided by file systems ◮ They base their aplications on these assumptions 5 Steven Lang September 4, 2016

  12. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Introduction ◮ Being too optimistic about crash guarantees leads to serious data losses 6 Steven Lang September 4, 2016

  13. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Introduction ◮ Being too optimistic about ◮ Being too conservative is crash guarantees leads to expensive in energy, performance, and hardware serious data losses lifespan 6 Steven Lang September 4, 2016

  14. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Background The POSIX file system interface ◮ POSIX standard defines a set of system calls for fs access operation description open allocate file descriptor perform file operations write, read link, unlink, mkdir perform directory operations explicitly flush data to disk sync, fsync deallocate file descriptor close ◮ fsync system call is key to provide data integrity 7 Steven Lang September 4, 2016

  15. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Crash-Consistency Models ◮ Used to define permissible states of a file system after a crash ◮ Consist of: ◮ Litmus tests : demonstrate allowed/forbidden behaviors of file systems across crashes ◮ Formal specifications : logic and state machines, describing crash-consistency behavior axiomatic and operational 8 Steven Lang September 4, 2016

  16. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Crash-Consistency Models Litmus tests Litmus tests consist of three parts: 1. Initial setup (optional) Example: initial: f ← creat("f", 0600) 9 Steven Lang September 4, 2016

  17. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Crash-Consistency Models Litmus tests Litmus tests consist of three parts: 1. Initial setup (optional) 2. Main body Example: initial: f ← creat("f", 0600) main: write(f, "data") fsync(f) mark("done") close(f) 9 Steven Lang September 4, 2016

  18. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Crash-Consistency Models Litmus tests Litmus tests consist of three parts: 1. Initial setup (optional) 2. Main body 3. Final checking Example: initial: f ← creat("f", 0600) main: write(f, "data") fsync(f) mark("done") close(f) exists?: marked("done") ∧ content("f") � = "data" 9 Steven Lang September 4, 2016

  19. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Crash-Consistency Models Litmus tests: Prefix-append (PA) ◮ The prefix-append (PA) litmus test checks whether, in the event of a crash, a file always contains a prefix of the data that has been appended to it initial: N ← 2500 as , bs ← "a" * N, "b" * N f ← creat("file", 0600) write(f, as) main: write(f, bs) exists?: content("file") � as + bs ◮ Also known as "safe-append" ◮ Popular file systems ( ext4 ) do not guarantee this property 10 Steven Lang September 4, 2016

  20. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Crash-Consistency Models Litmus tests: Atomic-replace-via-rename (ARVR) ◮ ARVR checks whether replacing file contents via rename is atomic across crashes initial: g ← creat("file", 0600) write(g, old) main: f ← creat("file.tmp", 0600) write(f, new) rename("file.tmp", "file") exists?: content("file") � = old ∧ content("file") � = new 11 Steven Lang September 4, 2016

  21. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Crash-Consistency Models Formal specifications Two styles of specification: ◮ axiomatic : describe valid crash behaviors declaratively, using a set of axioms and ordering relations ◮ operational : abstract machines that simulate relevant aspects of file system behavior 12 Steven Lang September 4, 2016

  22. Specifying and Checking File System Crash-Consistency Models Johannes Gutenberg Universität Mainz Crash-Consistency Models Formal specifications Two styles of specification: ◮ axiomatic : describe valid crash behaviors declaratively, using a set of axioms and ordering relations ◮ operational : abstract machines that simulate relevant aspects of file system behavior Example models will be shown for: ◮ seqfs , an ideal file system with strong crash consistency guarantees ◮ ext4 , a real file system with weak consistency guarantees 12 Steven Lang September 4, 2016

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend