Mehdi Akiki

Posts tagged "file system"

  • Published on

    Investigation · Part 19 of 20 · What survives a crash

    Updating Several Files at Once With One Rename

    Two files saved safely one after the other are not saved safely together: a kill left a new config with old data 85 times in 300. A version directory and one symlink rename, or renameat2 with RENAME_EXCHANGE, switched both files at once in every test. LevelDB does the same with CURRENT.
  • Published on

    Investigation · Part 18 of 20 · What survives a crash

    Checksums: Catching Corruption the Disk Did Not Report

    I flipped one bit in four files. My log's CRC caught it and then threw away nine good records, SQLite returned the changed value and its integrity check said ok, gzip reported a CRC error, and the text file changed silently. Where checksums belong, and what ext4 checks itself.
  • Published on

    Investigation · Part 5 of 20 · What survives a crash

    The Zero-Length File Problem and What ext4 Does About It

    In 2009, ext4 users found empty files after crashes, and ext4 got a heuristic called auto_da_alloc. I watched it work on my laptop: a rename over an existing file starts the writeback at once. It protects against the worst case, but it is not durability.
  • Published on

    Investigation · Part 4 of 20 · What survives a crash

    Why the Directory Needs fsync Too

    fsync of a new file does not promise that its name is on the disk. I measured directory fsync on ext4: half a microsecond after a file fsync, about 420 microseconds after a rename, and alone it made the name durable while the data stayed in RAM.
  • Published on

    Investigation · Part 3 of 20 · What survives a crash

    How to Save a File Without Losing It: Write, fsync, Rename

    I killed a program 300 times while it saved a file. Writing in place left a cut file 233 times, without any power loss. A temp file, fsync and rename never did. Then I traced how sed, Python, cp, install and git save files.