ceph: return the real size read when it hits EOF
authorXiubo Li <xiubli@redhat.com>
Sat, 30 Oct 2021 05:16:40 +0000 (13:16 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 8 Nov 2021 02:29:52 +0000 (03:29 +0100)
commitc3d8e0b5de487a7c462781745bc17694a4266696
tree34dd29f9ea47d17e0a11b3213c51e1be3e67f603
parent8cfc0c7ed34f7929ce7e5d7c6eecf4d01ba89a84
ceph: return the real size read when it hits EOF

Currently, if the sync read handler ends up reading more from the last
object in the file than the i_size indicates, then it'll end up
returning the wrong length. Ensure that we cap the returned length and
pos at the EOF.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/file.c