On Mon, Dec 10, 2018 at 1:16 PM Guillermo Rodriguez Garcia <guille.rodriguez@xxxxxxxxx> wrote: > > 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? I fear the docs are ambiguous. You need to sync the parent too, like on any other filesystem. -- Thanks, //richard ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/