[PATCH 2/2] libceph: just wait for more data to be available on the socket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux