1

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=ordered

All 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 FileOutputStream in Java v8.
  • OS is Ubuntu 18.04.6.
1
  • 2
    Does your physical storage device guarantee ordering of writes? Some other filesystems (mainly Btrfs, which relies strongly on it) have discovered that many cheap consumer SSDs ignore "write barrier" requests from the OS and reorder the physical writes as they see fit. Commented Oct 21, 2024 at 11:37

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.