aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_vnodeops.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2015-02-23 22:37:08 +1100
committerBen Hutchings <ben@decadent.org.uk>2015-05-09 23:16:20 +0100
commit508489491f1dc63de67634a73ac255bb03204c25 (patch)
tree2e8450c0a851f965ea1b5c46ccf0249302af9c55 /fs/xfs/xfs_vnodeops.h
parent17f606d841fbc7e0331af2f0cab2af801f18ed46 (diff)
downloadkernel_samsung_smdk4412-508489491f1dc63de67634a73ac255bb03204c25.zip
kernel_samsung_smdk4412-508489491f1dc63de67634a73ac255bb03204c25.tar.gz
kernel_samsung_smdk4412-508489491f1dc63de67634a73ac255bb03204c25.tar.bz2
xfs: ensure truncate forces zeroed blocks to disk
commit 5885ebda878b47c4b4602d4b0410cb4b282af024 upstream. A new fsync vs power fail test in xfstests indicated that XFS can have unreliable data consistency when doing extending truncates that require block zeroing. The blocks beyond EOF get zeroed in memory, but we never force those changes to disk before we run the transaction that extends the file size and exposes those blocks to userspace. This can result in the blocks not being correctly zeroed after a crash. Because in-memory behaviour is correct, tools like fsx don't pick up any coherency problems - it's not until the filesystem is shutdown or the system crashes after writing the truncate transaction to the journal but before the zeroed data in the page cache is flushed that the issue is exposed. Fix this by also flushing the dirty data in memory region between the old size and new size when we've found blocks that need zeroing in the truncate process. Reported-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> [bwh: Backported to 3.2: adjust filename, context] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'fs/xfs/xfs_vnodeops.h')
-rw-r--r--fs/xfs/xfs_vnodeops.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h
index 35d3d51..c0f7714 100644
--- a/fs/xfs/xfs_vnodeops.h
+++ b/fs/xfs/xfs_vnodeops.h
@@ -59,6 +59,7 @@ int xfs_flush_pages(struct xfs_inode *ip, xfs_off_t first,
xfs_off_t last, uint64_t flags, int fiopt);
int xfs_wait_on_pages(struct xfs_inode *ip, xfs_off_t first, xfs_off_t last);
-int xfs_zero_eof(struct xfs_inode *, xfs_off_t, xfs_fsize_t);
+int xfs_zero_eof(struct xfs_inode *ip, xfs_off_t offset,
+ xfs_fsize_t isize, bool *did_zeroing);
#endif /* _XFS_VNODEOPS_H */