From: Xiubo Li <xiubli@xxxxxxxxxx> The messages from ceph maybe split into multiple socket packages and we just need to wait for all the data to be availiable on the sokcet. URL: https://tracker.ceph.com/issues/63586 Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx> --- net/ceph/messenger_v1.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/net/ceph/messenger_v1.c b/net/ceph/messenger_v1.c index f9a50d7f0d20..aff81fef932f 100644 --- a/net/ceph/messenger_v1.c +++ b/net/ceph/messenger_v1.c @@ -1160,15 +1160,17 @@ static int read_partial_message(struct ceph_connection *con) /* header */ size = sizeof(con->v1.in_hdr); end = size; - ret = read_partial(con, end, size, &con->v1.in_hdr); - if (ret <= 0) - return ret; + if (con->v1.in_base_pos < end) { + ret = read_partial(con, end, size, &con->v1.in_hdr); + if (ret <= 0) + return ret; - crc = crc32c(0, &con->v1.in_hdr, offsetof(struct ceph_msg_header, crc)); - if (cpu_to_le32(crc) != con->v1.in_hdr.crc) { - pr_err("read_partial_message bad hdr crc %u != expected %u\n", - crc, con->v1.in_hdr.crc); - return -EBADMSG; + crc = crc32c(0, &con->v1.in_hdr, offsetof(struct ceph_msg_header, crc)); + if (cpu_to_le32(crc) != con->v1.in_hdr.crc) { + pr_err("read_partial_message bad hdr crc %u != expected %u\n", + crc, con->v1.in_hdr.crc); + return -EBADMSG; + } } front_len = le32_to_cpu(con->v1.in_hdr.front_len); -- 2.43.0