Bug 617690 - ext4 and xfs wrong data returned on read after write if file size was changed with ftruncate
ext4 and xfs wrong data returned on read after write if file size was changed...
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
All Linux
low Severity high
: rc
: ---
Assigned To: Eric Sandeen
Boris Ranto
Depends On:
  Show dependency treegraph
Reported: 2010-07-23 14:36 EDT by Chris Brown
Modified: 2013-02-19 12:51 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-01-13 16:44:45 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Linux Kernel 16165 None None None Never

  None (edit)
Description Chris Brown 2010-07-23 14:36:22 EDT
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.

Reproducible: Always  
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.
Comment 1 Eric Sandeen 2010-07-26 16:19:13 EDT
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.
Comment 2 Chris Brown 2010-07-27 00:01:52 EDT
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?
Comment 3 Eric Sandeen 2010-07-27 12:27:32 EDT
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.

Comment 4 RHEL Product and Program Management 2010-07-27 12:39:16 EDT
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
Comment 5 Eric Sandeen 2010-07-27 12:40:09 EDT
Also - I assume that a workaround might be to pre-allocate the image, in the meantime?
Comment 10 Jarod Wilson 2010-09-10 17:40:56 EDT
in kernel-2.6.18-219.el5
You can download this test kernel from http://people.redhat.com/jwilson/el5

Detailed testing feedback is always welcomed.
Comment 14 errata-xmlrpc 2011-01-13 16:44:45 EST
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.


Note You need to log in before you can comment on or make changes to this bug.