Failure-atomic msync
Failure-atomic msync commits a batch of memory-mapped updates as a crash-consistent unit, extending ordinary mapped-file synchronization.
Commit boundary: the EuroSys 2013 prototype adds MAP_ATOMIC, suppresses premature writeback and puts the dirty-page batch into one JBD2 handle. Ordinary ext4 data journaling does not expose that application-selected boundary. Once the complete redo record is durable, recovery can finish updating the file even if home-location writes are incomplete. [1]
Concurrency: applications must coordinate writers and choose consistent commit points. Failure atomicity supplies neither isolation nor protection against a storage device that loses acknowledged writes. The evaluation used Linux 2.6.33 and disabled volatile device write caches; its performance results are not estimates for current systems. [1]
Snapshot implementation: Kelly's 2019 famus_snap uses FICLONE and recovers from the latest readable snapshot, not the possibly modified backing file. It synchronizes snapshot data, changes its permissions to mark completion, then synchronizes the snapshot again. The February 2020 erratum corrects the comment naming the backing file; the code already targets the snapshot. [2] [3]
Snapshot caller: famus_snap requires a fresh snapshot file for each commit; recycling one is unsafe. The API can synchronize one supplied directory, but the caller remains responsible for other required directory synchronization. Reflink support and enough space for later copy-on-write allocations are necessary. [4]
Relations
- related
- msync, AdvFS syncv, Memory-mapped file, Crash consistency, Copy-on-write (storage), Write-ahead log
Limitations
- Ordinary Linux MS_SYNC does not provide this failure-atomic commit contract. [5]
Citations
- Park, Kelly and Shen. Failure-Atomic msync(). EuroSys 2013, pp. 225-238, sections 3 and 5. DOI: 10.1145/2465351.2465374.
- Terence Kelly. Good Old-Fashioned Persistent Memory. USENIX ;login:, Winter 2019, pp. 29-34.
- Good Old-Fashioned Persistent Memory: erratum, 19 February 2020.
- Terence Kelly: famus and famus_snap source releases; reviewed famus_snap.h and famus_snap_sync() from the 29 November 2019 archive.
- Linux man-pages: msync(2), synchronization flags.
Further reading
Sources & caveats
- Source synthesis and implementation inspection, not a Hesela power-cut experiment.