[yocto] File synchronization on ubifs/xfs

Sebastian Brand sebastian.brand at axis.com
Mon Apr 15 05:31:31 PDT 2019


Hi all,

I stumbled into an file synchronization problem, and I am curious if there are more people using  Yocto and ubifs/xfs/similar that have an interest of "fsync before rename"?

When trying to atomically update a file a common flow is "create copy, edit copy, rename copy->original", but this does for some file systems not guarantee that the file is not empty after a power fail. A more correct flow is "create copy, edit copy, fsync copy, rename copy->original", at least according to file system developers. This has been discussed a lot and the general status seems to be that many file system developers think that applications that does not fsync before rename are broken, and many application developers think that fsync is implied at rename and this needs to be fixed in the file systems. (I am (trying to) not picking a side, and just trying to solve my problems :) )

Since some file systems common in embedded systems (UBIFS, XFS) does not implement automatic fsync before rename, this becomes a bit of a problem if applications in Yocto does not sync "correctly". One of these applications is sed (in-place edit), and I am currently working on a patch to add fsync before rename (as a feature). Busybox are not interested in the feature (as they are of the opinion that this should be solved in the file system), but I am curious if there is any interest in these kind of features in Yocto?

Regards,
Sebastian


More information about the yocto mailing list