Red Hat Bugzilla – Bug 617690
ext4 and xfs wrong data returned on read after write if file size was changed with ftruncate
Last modified: 2013-02-19 12:51:32 EST
from: https://bugzilla.kernel.org/show_bug.cgi?id=16165 [^]
> we use the direct async I/O API for file I/O in VirtualBox since 3.2 and got
> some reports about corrupted guest filesystems. It turned out that only users
> are affected which disk images are stored on a ext4 filesystem. I could create
> a testcase which reproduces the error. Further investigation showed that the
> data corruption happens if ftruncate is used, data is written to the so far
> unallocated offset and immediately read back. The buffer holding the read data
> contains only \0 afterwards. The data is there if the file is closed and
> another program is used to view the file content (less for example).
> Everything works if ftruncate is not used.
The test case is in the original bug report, which includes patches
for ext4 and xfs.
Additional Information This bug is preventing the usage of ext4 and xfs based filesystems with any
software which uses aio and ftruncate. VirtualBox is is rendered unuseable with
ext4 and XFS filesystems as a result of this bug.
The patches were claimed to fix the problem, but we've seen other issues w/ unaligned AIO to a sparse image file (think imagefile on ext4, with a partition starting on sector 63) which haven't been fixed yet.
We can leave this bug on for the originally reported (& fixed) problem, but wanted folks to be aware of the other unaligned/sparse/aio issue.
The patches do resolve the issue however applying them results in a non standard RHEL/CentOS/OEL kernel. Will this issue be addressed with the existing RHEL 5.5? I assume if this is not the case that at least this specific case as well as the others will be addressed with RHEL 6?
This is something we can try to address for RHEL5.6.
This specific case (as reported in the kernel.org bugzilla) is fixed in RHEL6.
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release. Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products. This request is not yet committed for inclusion in an Update
Also - I assume that a workaround might be to pre-allocate the image, in the meantime?
You can download this test kernel from http://people.redhat.com/jwilson/el5
Detailed testing feedback is always welcomed.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.