> On Wednesday 09 September 2009 22:30:28 Voser, Peter wrote:
> > Hi all,
> >
> > When I modify a file, invoke sync and unplug the power of my device, the
> > expected file content has been saved, but the time stamp is still the old
> > one (without fclose invocation).
> >
> > When I do the same with a friendly reboot, the file content is there
> > *and* the time stamp has been updated (still without fclose invocation).
> >
> > I would expect the file stamp to be updated with sync, too.
> >
> > Is this a bug or on purpose?
At this stage we should have the following behaviour
* fsync() of a file will flush the file's data and metadata.
* datasync() acts like fsync() although POSIX spec says that datasync() does
not update metadata. I'm not sure if this optional. This is perhaps a bug.
* sync() of a file system will flush the data of all files, but not its
metadata (timestamps etc). sync also has the sideeffect of writing the
checkpoint data.
I think the real question being raised by this thread is this:
Should sync() also write metadata?
By my reading of various manpages etc it seems that it should. I'll look into
doing this.
-- Charles