Commit f452a220 authored by David Howells's avatar David Howells Committed by Ilya Dryomov
Browse files

ceph: Fix incorrect flush end position calculation



In ceph, in fill_fscrypt_truncate(), the end flush position is calculated
by:

                loff_t lend = orig_pos + CEPH_FSCRYPT_BLOCK_SHIFT - 1;

but that's using the block shift not the block size.

Fix this to use the block size instead.

Fixes: 5c64737d ("ceph: add truncate size handling support for fscrypt")
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Reviewed-by: default avatarViacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent aed06d36
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2362,7 +2362,7 @@ static int fill_fscrypt_truncate(struct inode *inode,

	/* Try to writeback the dirty pagecaches */
	if (issued & (CEPH_CAP_FILE_BUFFER)) {
		loff_t lend = orig_pos + CEPH_FSCRYPT_BLOCK_SHIFT - 1;
		loff_t lend = orig_pos + CEPH_FSCRYPT_BLOCK_SIZE - 1;

		ret = filemap_write_and_wait_range(inode->i_mapping,
						   orig_pos, lend);