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

Re: Safe File Update (atomic)



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.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh


Reply to: