This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: aio_fsync() a directory ?
- From: Xavier Roche <roche+kml2 at exalead dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 22 Apr 2013 11:15:38 +0200
- Subject: Re: aio_fsync() a directory ?
- References: <513EEF07 dot 5090901 at 3ds dot com> <20130408212729 dot ED7592C085 at topped-with-meat dot com> <5163BA06 dot 30600 at exalead dot com> <20130411225058 dot 989CB2C07B at topped-with-meat dot com> <5167A305 dot 1010506 at exalead dot com>
Just to close this thread, Geoff Clare has summarized the changes
regarding aio_fsync() and relationship wrt. directory entry data.
<http://austingroupbugs.net/view.php?id=672>
"In the April 18 teleconference it was agreed that the standard
should mandate that directory operations are always synchronized
on conforming file systems, and should include warnings about
non-conforming configurations. The proposed changes are as follows.
Changes to XBD...
At page 94 line 2581-2588 section 3.376 change:
For read, when the operation has been completed or diagnosed if
unsuccessful. The read is complete only when an image of the data
has been successfully transferred to the requesting process. If
there were any pending write requests affecting the data to be
read at the time that the synchronized read operation was
requested, these write requests are successfully transferred prior
to reading the data.
For write, when the operation has been completed or diagnosed if
unsuccessful. The write is complete only when the data specified
in the write request is successfully transferred and all file
system information required to retrieve the data is successfully
transferred.
to:
For read operations, when the operation has been completed or
diagnosed if unsuccessful. The operation is complete only when an
image of the data has been successfully transferred to the
requesting process. If there were any pending write requests or
(if the file is a directory) directory modifications affecting
the data to be read at the time that the synchronized read
operation was requested, these requests are successfully
transferred prior to reading the data.
For write operations and directory modification operations, when
the operation has been completed or diagnosed if unsuccessful. The
operation is complete only when the written data or (if the file
is a directory) modified directory entries have been successfully
transferred to storage and all file system information required
to retrieve them is successfully transferred.
At page 107 line 2859 add a new XBD 4.2 section (and renumber the
current 4.2 and all later 4.x sections):
4.2 Directory Operations
All file system operations that read a directory or that modify
the contents of a directory (for example creating, unlinking, or
renaming a file) shall be completed as defined for synchronized
I/O data integrity completion (see section 3.376).
<small>Note: Although conforming file systems are required to
perform all directory modifications as synchronized I/O
operations, some file systems may support non-conforming
configurations (for example via mount options) where
directory modifications are not synchronized. Applications
that rely on directory modifications being synchronized should
only be used with such file systems in their conforming
configuration(s).</small>
Changes to XSH...
At page 574 line 19833 section aio_fsync() change the APPLICATION
USAGE section from:
None.
to:
Refer to fdatasync() and fsync().
At page 815 line 27215 section fdatasync() append to the first
paragraph:
If the file is a directory, an implicit fdatasync() is already
performed on every I/O operation (see XBD 4.2) and consequently
if fdatasync() is called explicitly it shall take no action and
shall return the value 0.
At page 815 line 27232 section fdatasync() change the APPLICATION
USAGE section from:
None.
to:
Although conforming file systems are required to complete all
directory modifications as defined for synchronized I/O data
integrity completion, some file systems may support non-conforming
configurations (for example via mount options) where directory
modifications are not synchronized. When the file system is
configured in this way, calls to fdatasync() on directories may
cause I/O operations to be synchronized, rather than being a no-op.
At page 954 line 31987 section fsync() add a new paragraph to the
APPLICATION USAGE section:
Since conforming file systems are required to complete all
directory modifications as defined for synchronized I/O data
integrity completion (see XBD 4.2), calling fsync() on a directory
only synchronizes the file attributes such as timestamps. However,
some file systems may support non-conforming configurations (for
example via mount options) where modifications to directory
contents are not synchronized. When the file system is configured
in this way, calls to fsync() on directories may cause directory
contents to be synchronized in addition to file attributes.
Changes to XRAT...
At page 3444 line 115531 add a new XRAT A.4.2 section (and renumber
the current A.4.2 and all later A.4.x sections):
A.4.2 Directory Operations
Earlier versions of this standard did not make clear that all directory
modifications are performed as synchronized I/O operations, although
that is the historical behavior and was always intended. Applications
have no need to call fdatasync() or fsync() on a directory unless
they want to synchronize the file attributes (using fsync()), provided
the directory is on a conforming file system. However, since
applications may wish to use fdatasync() or fsync() to synchronize
directory modifications on non-conforming file systems, implementations
are required to support fdatasync() on directories as a no-op on
conforming file systems."