diff options
author | Sage Weil <sage@newdream.net> | 2009-12-22 14:24:33 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-12-23 11:17:22 -0500 |
commit | 6df058c025ce343052c5516b1d8a9a7e73cddd64 (patch) | |
tree | 58230bd258f71c2c3adf56a55d11ed39f404d12a /fs/ceph/osd_client.c | |
parent | 0cf90ab5b075821940873e73cdbfeb8edc3dabe8 (diff) |
ceph: include transaction id in ceph_msg_header (protocol change)
Many (most?) message types include a transaction id. By including it in
the fixed size header, we always have it available even when we are unable
to allocate memory for the (larger, variable sized) message body. This
will allow us to error out the appropriate request instead of (silently)
dropping the reply.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/osd_client.c')
-rw-r--r-- | fs/ceph/osd_client.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/ceph/osd_client.c b/fs/ceph/osd_client.c index 374f0013956c..a0aac436d5d4 100644 --- a/fs/ceph/osd_client.c +++ b/fs/ceph/osd_client.c | |||
@@ -439,11 +439,9 @@ static struct ceph_osd *__lookup_osd(struct ceph_osd_client *osdc, int o) | |||
439 | static void register_request(struct ceph_osd_client *osdc, | 439 | static void register_request(struct ceph_osd_client *osdc, |
440 | struct ceph_osd_request *req) | 440 | struct ceph_osd_request *req) |
441 | { | 441 | { |
442 | struct ceph_osd_request_head *head = req->r_request->front.iov_base; | ||
443 | |||
444 | mutex_lock(&osdc->request_mutex); | 442 | mutex_lock(&osdc->request_mutex); |
445 | req->r_tid = ++osdc->last_tid; | 443 | req->r_tid = ++osdc->last_tid; |
446 | head->tid = cpu_to_le64(req->r_tid); | 444 | req->r_request->hdr.tid = cpu_to_le64(req->r_tid); |
447 | 445 | ||
448 | dout("register_request %p tid %lld\n", req, req->r_tid); | 446 | dout("register_request %p tid %lld\n", req, req->r_tid); |
449 | __insert_request(osdc, req); | 447 | __insert_request(osdc, req); |
@@ -702,9 +700,9 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg, | |||
702 | u64 tid; | 700 | u64 tid; |
703 | int numops, object_len, flags; | 701 | int numops, object_len, flags; |
704 | 702 | ||
703 | tid = le64_to_cpu(msg->hdr.tid); | ||
705 | if (msg->front.iov_len < sizeof(*rhead)) | 704 | if (msg->front.iov_len < sizeof(*rhead)) |
706 | goto bad; | 705 | goto bad; |
707 | tid = le64_to_cpu(rhead->tid); | ||
708 | numops = le32_to_cpu(rhead->num_ops); | 706 | numops = le32_to_cpu(rhead->num_ops); |
709 | object_len = le32_to_cpu(rhead->object_len); | 707 | object_len = le32_to_cpu(rhead->object_len); |
710 | if (msg->front.iov_len != sizeof(*rhead) + object_len + | 708 | if (msg->front.iov_len != sizeof(*rhead) + object_len + |
@@ -1002,7 +1000,6 @@ static int prepare_pages(struct ceph_connection *con, struct ceph_msg *m, | |||
1002 | { | 1000 | { |
1003 | struct ceph_osd *osd = con->private; | 1001 | struct ceph_osd *osd = con->private; |
1004 | struct ceph_osd_client *osdc; | 1002 | struct ceph_osd_client *osdc; |
1005 | struct ceph_osd_reply_head *rhead = m->front.iov_base; | ||
1006 | struct ceph_osd_request *req; | 1003 | struct ceph_osd_request *req; |
1007 | u64 tid; | 1004 | u64 tid; |
1008 | int ret = -1; | 1005 | int ret = -1; |
@@ -1016,7 +1013,7 @@ static int prepare_pages(struct ceph_connection *con, struct ceph_msg *m, | |||
1016 | if (unlikely(type != CEPH_MSG_OSD_OPREPLY)) | 1013 | if (unlikely(type != CEPH_MSG_OSD_OPREPLY)) |
1017 | return -1; /* hmm! */ | 1014 | return -1; /* hmm! */ |
1018 | 1015 | ||
1019 | tid = le64_to_cpu(rhead->tid); | 1016 | tid = le64_to_cpu(m->hdr.tid); |
1020 | mutex_lock(&osdc->request_mutex); | 1017 | mutex_lock(&osdc->request_mutex); |
1021 | req = __lookup_request(osdc, tid); | 1018 | req = __lookup_request(osdc, tid); |
1022 | if (!req) { | 1019 | if (!req) { |