diff options
author | Sage Weil <sage@newdream.net> | 2010-03-25 18:45:38 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-05-17 18:25:32 -0400 |
commit | dbad185d4939ffb806f6fa753ef9f470e3b72b62 (patch) | |
tree | 0d3aaa8f0028c8b4c7826ff2a9c292ca862cd64a /fs/ceph | |
parent | a5ee751c15016d0deee0d651e42a3b163ea73ade (diff) |
ceph: drop src address(es) from message header [new protocol feature]
The CEPH_FEATURE_NOSRCADDR protocol feature avoids putting the full source
address in each message header (twice). This patch switches the client to
the new scheme, and _requires_ this feature on the server. The server
will support both the old and new schemes. That means an old client will
work with a new server, but a new client will not work with an old server.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/ceph_fs.h | 13 | ||||
-rw-r--r-- | fs/ceph/messenger.c | 14 | ||||
-rw-r--r-- | fs/ceph/msgr.h | 20 |
3 files changed, 36 insertions, 11 deletions
diff --git a/fs/ceph/ceph_fs.h b/fs/ceph/ceph_fs.h index 0c2241ef3653..8b194c6ef7d3 100644 --- a/fs/ceph/ceph_fs.h +++ b/fs/ceph/ceph_fs.h | |||
@@ -53,8 +53,17 @@ | |||
53 | /* | 53 | /* |
54 | * feature bits | 54 | * feature bits |
55 | */ | 55 | */ |
56 | #define CEPH_FEATURE_SUPPORTED 0 | 56 | #define CEPH_FEATURE_UID 1 |
57 | #define CEPH_FEATURE_REQUIRED 0 | 57 | #define CEPH_FEATURE_NOSRCADDR 2 |
58 | |||
59 | #define CEPH_FEATURE_SUPPORTED_MON CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR | ||
60 | #define CEPH_FEATURE_REQUIRED_MON CEPH_FEATURE_UID | ||
61 | #define CEPH_FEATURE_SUPPORTED_MDS CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR | ||
62 | #define CEPH_FEATURE_REQUIRED_MDS CEPH_FEATURE_UID | ||
63 | #define CEPH_FEATURE_SUPPORTED_OSD CEPH_FEATURE_UID|CEPH_FEATURE_NOSRCADDR | ||
64 | #define CEPH_FEATURE_REQUIRED_OSD CEPH_FEATURE_UID | ||
65 | #define CEPH_FEATURE_SUPPORTED_CLIENT CEPH_FEATURE_NOSRCADDR | ||
66 | #define CEPH_FEATURE_REQUIRED_CLIENT CEPH_FEATURE_NOSRCADDR | ||
58 | 67 | ||
59 | 68 | ||
60 | /* | 69 | /* |
diff --git a/fs/ceph/messenger.c b/fs/ceph/messenger.c index bb16edb1aef6..fe75ec7d8402 100644 --- a/fs/ceph/messenger.c +++ b/fs/ceph/messenger.c | |||
@@ -663,7 +663,7 @@ static void prepare_write_connect(struct ceph_messenger *msgr, | |||
663 | dout("prepare_write_connect %p cseq=%d gseq=%d proto=%d\n", con, | 663 | dout("prepare_write_connect %p cseq=%d gseq=%d proto=%d\n", con, |
664 | con->connect_seq, global_seq, proto); | 664 | con->connect_seq, global_seq, proto); |
665 | 665 | ||
666 | con->out_connect.features = CEPH_FEATURE_SUPPORTED; | 666 | con->out_connect.features = CEPH_FEATURE_SUPPORTED_CLIENT; |
667 | con->out_connect.host_type = cpu_to_le32(CEPH_ENTITY_TYPE_CLIENT); | 667 | con->out_connect.host_type = cpu_to_le32(CEPH_ENTITY_TYPE_CLIENT); |
668 | con->out_connect.connect_seq = cpu_to_le32(con->connect_seq); | 668 | con->out_connect.connect_seq = cpu_to_le32(con->connect_seq); |
669 | con->out_connect.global_seq = cpu_to_le32(global_seq); | 669 | con->out_connect.global_seq = cpu_to_le32(global_seq); |
@@ -1126,8 +1126,8 @@ static void fail_protocol(struct ceph_connection *con) | |||
1126 | 1126 | ||
1127 | static int process_connect(struct ceph_connection *con) | 1127 | static int process_connect(struct ceph_connection *con) |
1128 | { | 1128 | { |
1129 | u64 sup_feat = CEPH_FEATURE_SUPPORTED; | 1129 | u64 sup_feat = CEPH_FEATURE_SUPPORTED_CLIENT; |
1130 | u64 req_feat = CEPH_FEATURE_REQUIRED; | 1130 | u64 req_feat = CEPH_FEATURE_REQUIRED_CLIENT; |
1131 | u64 server_feat = le64_to_cpu(con->in_reply.features); | 1131 | u64 server_feat = le64_to_cpu(con->in_reply.features); |
1132 | 1132 | ||
1133 | dout("process_connect on %p tag %d\n", con, (int)con->in_tag); | 1133 | dout("process_connect on %p tag %d\n", con, (int)con->in_tag); |
@@ -1514,14 +1514,14 @@ static void process_message(struct ceph_connection *con) | |||
1514 | 1514 | ||
1515 | /* if first message, set peer_name */ | 1515 | /* if first message, set peer_name */ |
1516 | if (con->peer_name.type == 0) | 1516 | if (con->peer_name.type == 0) |
1517 | con->peer_name = msg->hdr.src.name; | 1517 | con->peer_name = msg->hdr.src; |
1518 | 1518 | ||
1519 | con->in_seq++; | 1519 | con->in_seq++; |
1520 | mutex_unlock(&con->mutex); | 1520 | mutex_unlock(&con->mutex); |
1521 | 1521 | ||
1522 | dout("===== %p %llu from %s%lld %d=%s len %d+%d (%u %u %u) =====\n", | 1522 | dout("===== %p %llu from %s%lld %d=%s len %d+%d (%u %u %u) =====\n", |
1523 | msg, le64_to_cpu(msg->hdr.seq), | 1523 | msg, le64_to_cpu(msg->hdr.seq), |
1524 | ENTITY_NAME(msg->hdr.src.name), | 1524 | ENTITY_NAME(msg->hdr.src), |
1525 | le16_to_cpu(msg->hdr.type), | 1525 | le16_to_cpu(msg->hdr.type), |
1526 | ceph_msg_type_name(le16_to_cpu(msg->hdr.type)), | 1526 | ceph_msg_type_name(le16_to_cpu(msg->hdr.type)), |
1527 | le32_to_cpu(msg->hdr.front_len), | 1527 | le32_to_cpu(msg->hdr.front_len), |
@@ -1987,9 +1987,7 @@ void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg) | |||
1987 | } | 1987 | } |
1988 | 1988 | ||
1989 | /* set src+dst */ | 1989 | /* set src+dst */ |
1990 | msg->hdr.src.name = con->msgr->inst.name; | 1990 | msg->hdr.src = con->msgr->inst.name; |
1991 | msg->hdr.src.addr = con->msgr->my_enc_addr; | ||
1992 | msg->hdr.orig_src = msg->hdr.src; | ||
1993 | 1991 | ||
1994 | BUG_ON(msg->front.iov_len != le32_to_cpu(msg->hdr.front_len)); | 1992 | BUG_ON(msg->front.iov_len != le32_to_cpu(msg->hdr.front_len)); |
1995 | 1993 | ||
diff --git a/fs/ceph/msgr.h b/fs/ceph/msgr.h index 8aaab414f3f8..6baa8e4f8e7f 100644 --- a/fs/ceph/msgr.h +++ b/fs/ceph/msgr.h | |||
@@ -120,7 +120,7 @@ struct ceph_msg_connect_reply { | |||
120 | /* | 120 | /* |
121 | * message header | 121 | * message header |
122 | */ | 122 | */ |
123 | struct ceph_msg_header { | 123 | struct ceph_msg_header_old { |
124 | __le64 seq; /* message seq# for this session */ | 124 | __le64 seq; /* message seq# for this session */ |
125 | __le64 tid; /* transaction id */ | 125 | __le64 tid; /* transaction id */ |
126 | __le16 type; /* message type */ | 126 | __le16 type; /* message type */ |
@@ -138,6 +138,24 @@ struct ceph_msg_header { | |||
138 | __le32 crc; /* header crc32c */ | 138 | __le32 crc; /* header crc32c */ |
139 | } __attribute__ ((packed)); | 139 | } __attribute__ ((packed)); |
140 | 140 | ||
141 | struct ceph_msg_header { | ||
142 | __le64 seq; /* message seq# for this session */ | ||
143 | __le64 tid; /* transaction id */ | ||
144 | __le16 type; /* message type */ | ||
145 | __le16 priority; /* priority. higher value == higher priority */ | ||
146 | __le16 version; /* version of message encoding */ | ||
147 | |||
148 | __le32 front_len; /* bytes in main payload */ | ||
149 | __le32 middle_len;/* bytes in middle payload */ | ||
150 | __le32 data_len; /* bytes of data payload */ | ||
151 | __le16 data_off; /* sender: include full offset; | ||
152 | receiver: mask against ~PAGE_MASK */ | ||
153 | |||
154 | struct ceph_entity_name src; | ||
155 | __le32 reserved; | ||
156 | __le32 crc; /* header crc32c */ | ||
157 | } __attribute__ ((packed)); | ||
158 | |||
141 | #define CEPH_MSG_PRIO_LOW 64 | 159 | #define CEPH_MSG_PRIO_LOW 64 |
142 | #define CEPH_MSG_PRIO_DEFAULT 127 | 160 | #define CEPH_MSG_PRIO_DEFAULT 127 |
143 | #define CEPH_MSG_PRIO_HIGH 196 | 161 | #define CEPH_MSG_PRIO_HIGH 196 |