]> git.itanic.dy.fi Git - linux-stable/commit
ceph: stop copying to iter at EOF on sync reads
authorXiubo Li <xiubli@redhat.com>
Wed, 21 Feb 2024 01:16:12 +0000 (09:16 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:17:36 +0000 (18:17 -0400)
commit834c93dcef0beacfee365bd55741d6dba147aa37
tree4b93b949acb58dd5ef1bd62c60a6803cec4a9c61
parentb15bce16661e5cc58e2c66a4f26683dfa1b460a2
ceph: stop copying to iter at EOF on sync reads

[ Upstream commit 1065da21e5df9d843d2c5165d5d576be000142a6 ]

If EOF is encountered, ceph_sync_read() return value is adjusted down
according to i_size, but the "to" iter is advanced by the actual number
of bytes read.  Then, when retrying, the remainder of the range may be
skipped incorrectly.

Ensure that the "to" iter is advanced only until EOF.

[ idryomov: changelog ]

Fixes: c3d8e0b5de48 ("ceph: return the real size read when it hits EOF")
Reported-by: Frank Hsiao <frankhsiao@qnap.com>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Tested-by: Frank Hsiao <frankhsiao@qnap.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ceph/file.c