6 second sleep required for file sync?

Chris David cd at chrisdavid.com
Thu Jan 9 16:40:22 EST 2014


Hello,

I am noticing some odd behavior that seems inconsistent with at least
some of the UBIFS documentation.

When unpacking an UBI image, it seems that an operation like "sync ;
sleep 6 ; sync" is required in order to synchronize all the files to
flash.  After simply changing the 6 to a 5, and then after cutting
power after the second sleep, truncated files are observed, including
both 0 length files, and some that are just missing contents toward
the end.

It seems this could be an artifact of the UBI write back buffer.  The
timing seems sensitive around 5 seconds, and this happens to be the
maximum time on the UBI write back buffer flush.

None the less, it is surprising more than a single sync is required to
flush all the files, based on my interpretation of the documentation
and FAQ.

Is this a known or expected behavior?  Or could it possibly be a bug?

And what I really want to know is, could the 6 second sleep and
additional sleep be required during the data synchronization step when
doing a POSIX atomic file operation?  Or is this odd behavior specific
to unpacking a UBIFS image?  I can say I have only observed this
behavior while unpacking a UBIFS image so far.

I'm not subscribed to the email list, please reply to me directly.

Thanks,

Chris David



More information about the linux-mtd mailing list