Commit 2cb494b7 authored by Ilya Dryomov's avatar Ilya Dryomov Committed by Kamal Mostafa

libceph: use the right footer size when skipping a message

commit dbc0d3ca upstream.

ceph_msg_footer is 21 bytes long, while ceph_msg_footer_old is only 13.
Don't skip too much when CEPH_FEATURE_MSG_AUTH isn't negotiated.
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent 1b04601d
...@@ -1203,6 +1203,13 @@ static bool ceph_msg_data_advance(struct ceph_msg_data_cursor *cursor, ...@@ -1203,6 +1203,13 @@ static bool ceph_msg_data_advance(struct ceph_msg_data_cursor *cursor,
return new_piece; return new_piece;
} }
static size_t sizeof_footer(struct ceph_connection *con)
{
return (con->peer_features & CEPH_FEATURE_MSG_AUTH) ?
sizeof(struct ceph_msg_footer) :
sizeof(struct ceph_msg_footer_old);
}
static void prepare_message_data(struct ceph_msg *msg, u32 data_len) static void prepare_message_data(struct ceph_msg *msg, u32 data_len)
{ {
BUG_ON(!msg); BUG_ON(!msg);
...@@ -2326,7 +2333,7 @@ static int read_partial_message(struct ceph_connection *con) ...@@ -2326,7 +2333,7 @@ static int read_partial_message(struct ceph_connection *con)
ceph_pr_addr(&con->peer_addr.in_addr), ceph_pr_addr(&con->peer_addr.in_addr),
seq, con->in_seq + 1); seq, con->in_seq + 1);
con->in_base_pos = -front_len - middle_len - data_len - con->in_base_pos = -front_len - middle_len - data_len -
sizeof(m->footer); sizeof_footer(con);
con->in_tag = CEPH_MSGR_TAG_READY; con->in_tag = CEPH_MSGR_TAG_READY;
return 1; return 1;
} else if ((s64)seq - (s64)con->in_seq > 1) { } else if ((s64)seq - (s64)con->in_seq > 1) {
...@@ -2358,7 +2365,7 @@ static int read_partial_message(struct ceph_connection *con) ...@@ -2358,7 +2365,7 @@ static int read_partial_message(struct ceph_connection *con)
/* skip this message */ /* skip this message */
dout("alloc_msg said skip message\n"); dout("alloc_msg said skip message\n");
con->in_base_pos = -front_len - middle_len - data_len - con->in_base_pos = -front_len - middle_len - data_len -
sizeof(m->footer); sizeof_footer(con);
con->in_tag = CEPH_MSGR_TAG_READY; con->in_tag = CEPH_MSGR_TAG_READY;
con->in_seq++; con->in_seq++;
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment