[Top] [All Lists]

Re: fsync, rename, O_ATOMIC/O_PONIES

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: fsync, rename, O_ATOMIC/O_PONIES
From: Olaf van der Spek <olaf@xxxxxxxx>
Date: Sun, 04 Mar 2012 18:14:39 +0100
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20120302131240.GA14186@xxxxxxxxxxxxx>
References: <4F50BF89.7020909@xxxxxxxx> <20120302131240.GA14186@xxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2
On 2-3-2012 14:12, Christoph Hellwig wrote:
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?

For example

The possibilities are sheer endless.


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

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

Argh, come on.
That's not real and it's not complete. tmpfile is undefined, errors aren't handled and you have lots of unlisted assumptions or regressions.


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