summaryrefslogtreecommitdiff
path: root/fs/ceph
diff options
context:
space:
mode:
authorLuis Henriques <lhenriques@suse.com>2019-07-01 18:16:34 +0100
committerIlya Dryomov <idryomov@gmail.com>2019-07-08 14:01:45 +0200
commitd31d07b97a5e76f41e00eb81dcca740e84aa7782 (patch)
treecc06c96da54682497e189daffc457bd8c3c96753 /fs/ceph
parent52dd0f1b3f94e600901ad785226e597743401245 (diff)
downloadlinux-rpi-d31d07b97a5e76f41e00eb81dcca740e84aa7782.tar.gz
linux-rpi-d31d07b97a5e76f41e00eb81dcca740e84aa7782.tar.bz2
linux-rpi-d31d07b97a5e76f41e00eb81dcca740e84aa7782.zip
ceph: fix end offset in truncate_inode_pages_range call
Commit e450f4d1a5d6 ("ceph: pass inclusive lend parameter to filemap_write_and_wait_range()") fixed the end offset parameter used to call filemap_write_and_wait_range and invalidate_inode_pages2_range. Unfortunately it missed truncate_inode_pages_range, introducing a regression that is easily detected by xfstest generic/130. The problem is that when doing direct IO it is possible that an extra page is truncated from the page cache when the end offset is page aligned. This can cause data loss if that page hasn't been sync'ed to the OSDs. While there, change code to use PAGE_ALIGN macro instead. Cc: stable@vger.kernel.org Fixes: e450f4d1a5d6 ("ceph: pass inclusive lend parameter to filemap_write_and_wait_range()") Signed-off-by: Luis Henriques <lhenriques@suse.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index d5bee928603a..95685b4aac48 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -1011,7 +1011,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
* may block.
*/
truncate_inode_pages_range(inode->i_mapping, pos,
- (pos+len) | (PAGE_SIZE - 1));
+ PAGE_ALIGN(pos + len) - 1);
req->r_mtime = mtime;
}