xfs
[Top] [All Lists]

Re: fsync, rename, O_ATOMIC/O_PONIES

To: Olaf van der Spek <olaf@xxxxxxxx>
Subject: Re: fsync, rename, O_ATOMIC/O_PONIES
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Fri, 2 Mar 2012 08:12:40 -0500
Cc: xfs@xxxxxxxxxxx
In-reply-to: <4F50BF89.7020909@xxxxxxxx>
References: <4F50BF89.7020909@xxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
> 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);


<Prev in Thread] Current Thread [Next in Thread>