If we call
stat() on a just created file on s390x or arm64, then the value of
st_blocks field is often wrong (usually 1).
Steps to reproduce:
- Create a file large enough to occupy a handful of blocks.
syncfor good measure (doesn’t make any difference).
- Run the
statcommand get all stat information of that file and save its output. It is likely that it reports that the file occupies only one block.
statrepeatedly, and compare its output with the output we got in the previous point. After a few tries it will report the correct number of blocks.
This build runs the above steps:
As you can see, all three supported Ubuntu releases are affected on s390x and arm64, while amd64 and ppc64le are apparently not affected at all.
Interestingly, both s390x and arm64 have their root file system mounted through shiftfs, while amd64 and ppc64le use the good old ext4.