I have an embedded device which appends data to an ext4 file in data = ordered mode until its power is cut off. To my surprise, I've noticed that this occasionally results in zeros being appended to the file instead of the intended data. I thought this is impossible since data = ordered should guarantee that the data is written before the file size is updated. From the docs:
data=orderedAll data are forced directly out to the main file system prior to its metadata being committed to the journal.
Am I misunderstanding the meaning of "data" (file content) or "metadata" (file size) here, or what else is going on?
Other parameters which may be relevant:
- Writing is done using a
FileOutputStreamin Java v8. - OS is Ubuntu 18.04.6.