Since we have held the Fr capibility it's safe to skip reading from Rados if the ki_pos is larger than or euqals to the file size. Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx> --- fs/ceph/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 6c9e837aa1d3..330e42b3afec 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -1614,7 +1614,9 @@ static ssize_t ceph_read_iter(struct kiocb *iocb, struct iov_iter *to) return ret; } - if ((got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) == 0 || + if (unlikely(iocb->ki_pos >= i_size_read(inode))) { + ret = 0; + } else if ((got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) == 0 || (iocb->ki_flags & IOCB_DIRECT) || (fi->flags & CEPH_F_SYNC)) { -- 2.36.0.rc1