summaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2014-09-23 22:55:00 +1000
committerDave Chinner <david@fromorbit.com>2014-09-23 22:55:00 +1000
commit2ebff7bbd785c86e12956388b9e6f6bb8ea5d21e (patch)
treec0a3d0cec84187bdf66c674294d67e1416484996 /fs/xfs/libxfs
parent7abbb8f928e5b7cea1edd077131b2ace665c6712 (diff)
downloadblackbird-op-linux-2ebff7bbd785c86e12956388b9e6f6bb8ea5d21e.tar.gz
blackbird-op-linux-2ebff7bbd785c86e12956388b9e6f6bb8ea5d21e.zip
xfs: flush entire last page of old EOF on truncate up
On a sub-page sized filesystem, truncating a mapped region down leaves us in a world of hurt. We truncate the pagecache, zeroing the newly unused tail, then punch blocks out from under the page. If we then truncate the file back up immediately, we expose that unmapped hole to a dirty page mapped into the user application, and that's where it all goes wrong. In truncating the page cache, we avoid unmapping the tail page of the cache because it still contains valid data. The problem is that it also contains a hole after the truncate, but nobody told the mm subsystem that. Therefore, if the page is dirty before the truncate, we'll never get a .page_mkwrite callout after we extend the file and the application writes data into the hole on the page. Hence when we come to writing that region of the page, it has no blocks and no delayed allocation reservation and hence we toss the data away. This patch adds code to the truncate up case to solve it, by ensuring the partial page at the old EOF is always cleaned after we do any zeroing and move the EOF upwards. We can't actually serialise the page writeback and truncate against page faults (yes, that problem AGAIN) so this is really just a best effort and assumes it is extremely unlikely that someone is concurrently writing to the page at the EOF while extending the file. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/libxfs')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud