[OpenAFS-devel] The ihandle sync thing

Benjamin Kaduk kaduk@MIT.EDU
Fri, 29 Mar 2013 11:58:08 -0400 (EDT)


On Fri, 29 Mar 2013, chas williams - CONTRACTOR wrote:

> On Thu, 28 Mar 2013 13:47:18 -0400
> Garrett Wollman <wollman@csail.mit.edu> wrote:
>
>> I don't think that even with _POSIX_SYNCHRONIZED_IO the requirements
>> are tight enough to be truly useful -- just in the past week there has
>> been a discussion in the Austin Group about whether the Standard
>> actually requires that fsync() on a newly-created file actually ensure
>> that the directory entries for that file be committed to storage.
>
> I doesn't really matter what you think it should be, Linux doesn't do
> that. From the fsync() man page:

The whole world is not linux...

>       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.

The FreeBSD kernel fsync() implementation does not explicitly sync the 
directory containing the file, either.

> So, I think that is mildly interesting when you think about the namei
> fileserver's operation.  I don't think it ever sync's the underlying
> filesystem's parent directory for the vnode's (vnode's being either a
> file or directory).  It seems like this might be a problem for vnode
> creation and deletion.

And yet things usually work, because of pdflush/syncer thread/etc.

-Ben