[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: mode data=journal in ext3. Is it safe to use?

On 18 Jun 2004, Andreas Dilger wrote:
> On Jun 17, 2004  13:23 +0200, Petter Larsen wrote:
>> But think of your scenario of copy, delete and make a new file with the
>> new content. First we copy the contents of the file, then we do our
>> modifications. When we are done  we delete the original file. Then we hit
>> a crash. The content we had of the file in our process are  gone, the
>> original file is deleted. This is not a good idea. But if we write the new 
>> file first as fileX.new and den delete fileX, hit a crash then we would
>> have at least the  correct file written as fileX.new.
> The rename operation is guaranteed to be atomic. You implement updates as:
> 1) create new file
> 2) write data to new file
> 3) rename new file over old filename

Step three in this chain has always puzzled me: is there some "atomic
rename" that I have missed, or is this really:

  3) unlink (or rename away) old filename
  4) rename new filename to old filename

I refused to attend his funeral. But I wrote a very nice letter 
explaining that I approved of it.
        -- Mark Twain

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]