Skip to content

Commit 98ad5eb

Browse files
committed
libceph: ceph_connection_operations::reencode_message() method
Give upper layers a chance to reencode the message after the connection is negotiated and ->peer_features is set. OSD client will use this to support both luminous and pre-luminous OSDs (in a single cluster): the former need MOSDOp v8; the latter will continue to be sent MOSDOp v4. Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 2e59ffd commit 98ad5eb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

include/linux/ceph/messenger.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ struct ceph_connection_operations {
4444
struct ceph_msg_header *hdr,
4545
int *skip);
4646

47+
void (*reencode_message) (struct ceph_msg *msg);
48+
4749
int (*sign_message) (struct ceph_msg *msg);
4850
int (*check_message_signature) (struct ceph_msg *msg);
4951
};

net/ceph/messenger.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,13 +1288,16 @@ static void prepare_write_message(struct ceph_connection *con)
12881288
m->hdr.seq = cpu_to_le64(++con->out_seq);
12891289
m->needs_out_seq = false;
12901290
}
1291-
WARN_ON(m->data_length != le32_to_cpu(m->hdr.data_len));
1291+
1292+
if (con->ops->reencode_message)
1293+
con->ops->reencode_message(m);
12921294

12931295
dout("prepare_write_message %p seq %lld type %d len %d+%d+%zd\n",
12941296
m, con->out_seq, le16_to_cpu(m->hdr.type),
12951297
le32_to_cpu(m->hdr.front_len), le32_to_cpu(m->hdr.middle_len),
12961298
m->data_length);
1297-
BUG_ON(le32_to_cpu(m->hdr.front_len) != m->front.iov_len);
1299+
WARN_ON(m->front.iov_len != le32_to_cpu(m->hdr.front_len));
1300+
WARN_ON(m->data_length != le32_to_cpu(m->hdr.data_len));
12981301

12991302
/* tag + hdr + front + middle */
13001303
con_out_kvec_add(con, sizeof (tag_msg), &tag_msg);

0 commit comments

Comments
 (0)