ceph: Fix incorrect flush end position calculation
authorDavid Howells <dhowells@redhat.com>
Wed, 12 Mar 2025 10:47:11 +0000 (10:47 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 May 2025 05:58:58 +0000 (07:58 +0200)
commitaef37505c496b6d177aa975341efb184bf1764eb
treeef95245320899a5eee09f1f471cffe5e67fe4fb1
parent984830d902fbd1935872f57d5a23eedaa696bbc7
ceph: Fix incorrect flush end position calculation

[ Upstream commit f452a2204614fc10e2c3b85904c4bd300c2789dc ]

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: 5c64737d2536 ("ceph: add truncate size handling support for fscrypt")
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ceph/inode.c