6 ms·
This example used a read-only squashfs filesystem, making sync() irrelevant. Also, counting on sync() to write everything within two seconds seems problematic
by JoshTriplett 13y ago
This example used a read-only squashfs filesystem, making sync() irrelevant.
Also, counting on sync() to write everything within two seconds seems problematic as well.
- masklinn 13y agoIt's not sync() which is the problem. A correctly implemented `sync` should flush all writes to permanent storage before returning. The issue here is storage devices may lie about it[0]. The 2s sleep is problematic, but IIRC devices don't (and have no way to, and would not anyway) report when the data is actually written to permanent storage, so you can't do much besides waiting a bit and hoping for the best. [0] http://www.sqlite.org/howtocorrupt.html http://www.sqlite.org/howtocorrupt.html
- JoshTriplett 13y agoStorage devices actually do have several ways of reporting when data is permanently stored, and Linux makes use of them. However, some storage device manufacturers found that if they lied and claimed data was permanently stored when it wasn't quite yet, they got better benchmark results.
- masklinn 13y ago> Storage devices actually do have several ways of reporting when data is permanently stored Which `sync` uses. My comment was probably unclear, but the point I was trying to make is if they're lying to sync they're probably not going to provide other accurate ways to get the information.