Bug 617690

Summary: ext4 and xfs wrong data returned on read after write if file size was changed with ftruncate
Product: Red Hat Enterprise Linux 5 Reporter: Chris Brown <christopher.brown>
Component: kernelAssignee: Eric Sandeen <esandeen>
Status: CLOSED ERRATA QA Contact: Boris Ranto <branto>
Severity: high Docs Contact:
Priority: low    
Version: 5.7CC: branto, esandeen, yugzhang
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-13 21:44:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Chris Brown 2010-07-23 18:36:22 UTC
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 20:19:13 UTC
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 04:01:52 UTC
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 16:27:32 UTC
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.

-Eric

Comment 4 RHEL Program Management 2010-07-27 16:39:16 UTC
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
release.

Comment 5 Eric Sandeen 2010-07-27 16:40:09 UTC
Also - I assume that a workaround might be to pre-allocate the image, in the meantime?

Comment 10 Jarod Wilson 2010-09-10 21:40:56 UTC
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 21:44:45 UTC
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.

http://rhn.redhat.com/errata/RHSA-2011-0017.html