All of lore.kernel.org
 help / color / mirror / Atom feed
* Syncing a file's metadata in a portable way
@ 2004-07-09  3:06 Alberto Bertogli
  2004-07-09  9:39 ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Alberto Bertogli @ 2004-07-09  3:06 UTC (permalink / raw)
  To: linux-kernel


Hi!

I wanted to know if there was a common, portable way of syncing a given
file's metadata.

In particular, I just want to create a file with open() and be sure that
after some operation the file has been properly created and even if there
is a crash, it can be accessed (modulo internal disk caches and all that
stuff).

I know that fsync() provides only data guarantees, and even the manpage
says clearly that in order to sync metadata an "explicit fsync on the file
descriptor of the directory is also needed".

However, the O_DIRECTORY flag is Linux only, making this mechanism not
portable.

Is there a way of doing this in a portable way?

I know that under some filesystems with some mount options this can be
assured just by open() returning, or fsync() on the file, but I was
looking for a more general way to do it.


Also, according to SUSv3, "If _POSIX_SYNCHRONIZED_IO is defined, the
fsync() function shall force all currently queued I/O operations
associated with the file". This seems to imply that metadata gets synced
too, or at least I think "I/O operations associated with the file" can be
interpreted to include metadata.

However, based on a quick grep at the glibc code, it seems that the flag
doesn't make a difference in this case.

Is this really used or enforced?


Thanks a lot,
		Alberto



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-07-11 14:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-09  3:06 Syncing a file's metadata in a portable way Alberto Bertogli
2004-07-09  9:39 ` Andrew Morton
2004-07-10 11:54   ` bert hubert
2004-07-10 20:14     ` Andrew Morton
2004-07-11 10:27       ` bert hubert
2004-07-11 10:35         ` Andrew Morton
2004-07-11 14:19           ` Alberto Bertogli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.