xfs DIO data corruption
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux-lts-trusty (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
An appending DIO write will corrupt files on XFS.
The following patch needs to be backported:
commit b9d59846f73713d
Author: Dave Chinner <email address hidden>
Date: Thu Apr 16 22:03:07 2015 +1000
xfs: DIO write completion size updates race
xfs_
updating the in-core inode size. The IO completion processing is not
serialised for direct IO - they are done either under the
IOLOCK_SHARED for non-AIO DIO, and without any IOLOCK held at all
during AIO DIO completion. Hence the non-atomic test-and-set update
of the in-core inode size is racy and can result in the in-core
inode size going backwards if the race if hit just right.
If the inode size goes backwards, this can trigger the EOF zeroing
code to run incorrectly on the next IO, which then will zero data
that has successfully been written to disk by a previous DIO.
To fix this bug, we need to serialise the test/set updates of the
in-core inode size. This first patch introduces locking around the
relevant updates and checks in the DIO path. Because we now have an
ioend in xfs_end_
doing an IO that requires an in-core EOF update, and we know that
they are not running in interrupt context. As such, we do not need to
use irqsave() spinlock variants to protect against interrupts while
the lock is held.
Hence we can use an existing spinlock in the inode to do this
serialisation and so not need to grow the struct xfs_inode just to
work around this problem.
This patch does not address the test/set EOF update in
generic_
as a followup with separate explanation.
Signed-off-by: Dave Chinner <email address hidden>
Reviewed-by: Brian Foster <email address hidden>
Signed-off-by: Dave Chinner <email address hidden>
ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: linux-image-
ProcVersionSign
Uname: Linux 3.19.0-25-generic x86_64
ApportVersion: 2.14.1-0ubuntu3.11
Architecture: amd64
CurrentDesktop: Unity
Date: Tue Sep 29 19:29:28 2015
InstallationDate: Installed on 2015-09-29 (0 days ago)
InstallationMedia: Ubuntu 14.04.3 LTS "Trusty Tahr" - Beta amd64 (20150805)
SourcePackage: linux-lts-vivid
UpgradeStatus: No upgrade log present (probably fresh install)
affects: | linux-lts-vivid (Ubuntu) → linux-lts-trusty (Ubuntu) |
Status changed to 'Confirmed' because the bug affects multiple users.