Re: Safe File Update (atomic)
On Thu, Dec 30, 2010 at 4:24 PM, Henrique de Moraes Holschuh
> On Thu, 30 Dec 2010, Olaf van der Spek wrote:
>> The reason I asked for a kernelland solution is because it's hard if
>> not impossible to do properly in userland. But some kernel devs (Ted
>> and others) don't agree. They reason that the desire to preserve all
>> meta-data isn't reasonable by itself.
> It isn't.
> And you can do it anyway:
> 1. open target, keep it open.
> 2. do the safe open+write dance on the temp target.
> 3. get metadata from target by fd
> 4. apply metadata to temp target by fd
> 5. atomic rename
> 6. close both fds
> 7. sync parent dir.
Doesn't work for file-owner.
How does it handle meta-data you don't know about yet?