This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: aio_fsync() a directory ?
- From: KOSAKI Motohiro <kosaki dot motohiro at gmail dot com>
- To: libc-alpha at sourceware dot org
- Cc: kosaki dot motohiro at gmail dot com
- Date: Tue, 12 Mar 2013 16:47:38 -0400
- Subject: Re: aio_fsync() a directory ?
- References: <513EEF07.5090901@3ds.com>
(3/12/13 5:01 AM), Xavier Roche wrote:
> Hi folks!
>
> As a followup to a discussion
> (<https://groups.google.com/forum/?fromgroups#!topic/comp.unix.programmer/AM2V83RCOVE>)
> regarding synchronization of file operations (file creation, renaming,
> symlink, etc.), it seems that the only way to "commit" a filename change
> is to open() the containing directory in O_RDONLY, and fsync() the given
> file descriptor.
This is right from POSIX POV.
However, at least, ext4 and btrfs have a guarantee to commit when renaming.
Because kernel developers know that many application developers don't use fsync().
See below blog post and related discussions.
http://www.redditmirror.cc/cache/websites/thunk.org_846ih/thunk.org/tytso/blog/2009/03/12/delayed-allocation-and-the-zero-length-file-problem/index.html
Sorry for the offtopic.