]> git.ipfire.org Git - thirdparty/kernel/stable.git/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:20:11 +0000 (18:20 -0400)
commit3006137ed68a2442926fb0ef1115fcb69f066214
tree5d83b9c579b9298c0e71468d92ffefba9bc0ae05
parenta4cbcc4c4546480d69574fdff6a70842a43c2903
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