fsync, rename, O_ATOMIC/O_PONIES

Christoph Hellwig hch at infradead.org
Fri Mar 2 07:12:40 CST 2012


> I'd like to ask:
> - Is there a tool to log all unsafe operations?

What is an unsafe operation?  Anything that's dumb and might lose data?

The possibilities are sheer endless.

> - What is the *right* way to update a file?

 fd = open(tmpfile, ...);
 write(fd, ...);  // or any other update
 fdatasync(fd);
 rename(tmpfile, realfile);




More information about the xfs mailing list