UBIFS: Do we need to fsync the parent directory?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

When using the typical and well-known approach for atomic file updates:

fd = open(“foo.new”, O_WRONLY);
write(fd, buf, bufsize);
fsync(fd);
close(fd);
rename(“foo.new”, “foo”);

And assuming that we want to ensure not only that the update was
atomic, but also that the "new" version of the file will be available
in the event of a crash, normally one would also fsync the parent
directory.

Is this needed in UBIFS? The reason I am asking is this snippet from
the online documentation:

> fsync() may be called for directories - it synchronizes the directory inode meta-data. [...]
> The fdatasync() call for directories is "no-op" in UBIFS and all UBIFS operations which change directory entries are synchronous.

If I am reading correctly, the latter ("all UBIFS operations which
change directory entries are synchronous") seems to imply that calling
fsync on the parent dir would not be necessary. However my tests seem
to indicate otherwise. Am I misreading the docs?

Thank you,

Guillermo Rodriguez Garcia
guille.rodriguez@xxxxxxxxx

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux