Magnus Bodin wrote:
-snip-
> > fsync the data if you want the data on disk.
> > fsync the directory if you want the metadata on disk.
> >
> > What's complicated or difficult about that?
> 
> According to McKusick yesterday when I asked specifically about this problem
> discussed here, he admitted that fsync:ing a directory could be a costly
> operation if directories had to be fsynced recursively. In e.g. a
> queue-directory or a Maildir, it will probably have no impact.
> 
> Therefore, a fsync() of the file would be sufficient he said.
> Really two.
>   Maildir-example:
> 
>   1. write to tmp
>   2. fsync()
>   3. rename(tmp, new)
>   4. fsync()

This last fsync() is not needed. We only need the guarantee that the
unlink() happens AFTER the link() on the disk. Ordered metadata writes
give us that (in the standard FFS and softupdates case, not with EXT2
unless sync mounted).

-- 
Andre

Reply via email to