[Top] [All Lists]

Re: Directory fsync

To: Zhu Han <schumi.han@xxxxxxxxx>
Subject: Re: Directory fsync
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Fri, 23 Sep 2011 12:33:54 -0400
Cc: xfs@xxxxxxxxxxx
In-reply-to: <CAF7KpS8h2KDsLVzwAj=5ig-yuuiCwjQSVk0Nfy9UJ0qiyAqeCQ@xxxxxxxxxxxxxx>
References: <CAF7KpS8h2KDsLVzwAj=5ig-yuuiCwjQSVk0Nfy9UJ0qiyAqeCQ@xxxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Fri, Sep 23, 2011 at 11:12:02PM +0800, Zhu Han wrote:
> I note below words in the manual of fsync:
>        Calling  fsync()  does  not  necessarily  ensure  that  the entry in
> the directory containing the file has also reached disk.  For that an
> explicit fsync() on a file
>        descriptor for the directory is also needed.
> I am wondering is directory sync is essential after below steps if I want to
> assure the file can be retrieved after system crash?
> 1) create file A
> 2) write file A
> 3) fsync(file A)
> --------------------------------> fsync(parent directory) [Is it essential
> to make the inode linked to parent directory?]

As far as standards are concerned it is.  As far as the current XFS
implementation is concerned you don't need it as the file fsync will
also force out all transactions that belong to the create.

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