summaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2016-01-27 16:00:38 -0500
committerBob Peterson <rpeterso@redhat.com>2016-03-15 10:46:28 -0400
commit2df6f47150b6afbb258ed1d5c9ed78c23df05053 (patch)
tree5f67da00fb95f46a0f324d49b8714fdb1be83d62 /fs/gfs2
parent67893f12e5374bbcaaffbc6e570acbc2714ea884 (diff)
downloadlinux-2df6f47150b6afbb258ed1d5c9ed78c23df05053.tar.gz
linux-2df6f47150b6afbb258ed1d5c9ed78c23df05053.tar.bz2
linux-2df6f47150b6afbb258ed1d5c9ed78c23df05053.zip
GFS2: Fix direct IO write rounding error
The fsx test in xfstests was failing because it was using direct IO writes which were using a bad calculation. It was using loff_t lstart = offset & (PAGE_CACHE_SIZE - 1); when it should be loff_t lstart = offset & ~(PAGE_CACHE_SIZE - 1); Thus, the write at offset 0x67e00 was calculating lstart to be 0xe00, the address of our corruption. Instead, it should have been 0x67000. This patch fixes the calculation. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Acked-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/aops.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 93f07465e5a6..aa016e4b8bec 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -1082,7 +1082,7 @@ static ssize_t gfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
* the first place, mapping->nr_pages will always be zero.
*/
if (mapping->nrpages) {
- loff_t lstart = offset & (PAGE_CACHE_SIZE - 1);
+ loff_t lstart = offset & ~(PAGE_CACHE_SIZE - 1);
loff_t len = iov_iter_count(iter);
loff_t end = PAGE_ALIGN(offset + len) - 1;