summaryrefslogtreecommitdiffstats
path: root/fs/ceph/mon_client.c
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2010-01-08 22:58:34 +0100
committerSage Weil <sage@newdream.net>2010-01-25 21:57:37 +0100
commit2450418c47b7998ad55a73f23707b1e21c371eef (patch)
tree1e17dd88f86c5daa1bfbca1aeea0c909391b5829 /fs/ceph/mon_client.c
parentceph: properly handle aborted mds requests (diff)
downloadlinux-2450418c47b7998ad55a73f23707b1e21c371eef.tar.xz
linux-2450418c47b7998ad55a73f23707b1e21c371eef.zip
ceph: allocate middle of message before stating to read
Both front and middle parts of the message are now being allocated at the ceph_alloc_msg(). Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Diffstat (limited to 'fs/ceph/mon_client.c')
-rw-r--r--fs/ceph/mon_client.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/fs/ceph/mon_client.c b/fs/ceph/mon_client.c
index 223e8bc207e3..6c00b37cc554 100644
--- a/fs/ceph/mon_client.c
+++ b/fs/ceph/mon_client.c
@@ -692,21 +692,33 @@ static void dispatch(struct ceph_connection *con, struct ceph_msg *msg)
* Allocate memory for incoming message
*/
static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con,
- struct ceph_msg_header *hdr)
+ struct ceph_msg_header *hdr,
+ int *skip)
{
struct ceph_mon_client *monc = con->private;
int type = le16_to_cpu(hdr->type);
- int front = le32_to_cpu(hdr->front_len);
+ int front_len = le32_to_cpu(hdr->front_len);
+ struct ceph_msg *m;
+ *skip = 0;
switch (type) {
case CEPH_MSG_MON_SUBSCRIBE_ACK:
- return ceph_msgpool_get(&monc->msgpool_subscribe_ack, front);
+ m = ceph_msgpool_get(&monc->msgpool_subscribe_ack, front_len);
+ break;
case CEPH_MSG_STATFS_REPLY:
- return ceph_msgpool_get(&monc->msgpool_statfs_reply, front);
+ m = ceph_msgpool_get(&monc->msgpool_statfs_reply, front_len);
+ break;
case CEPH_MSG_AUTH_REPLY:
- return ceph_msgpool_get(&monc->msgpool_auth_reply, front);
+ m = ceph_msgpool_get(&monc->msgpool_auth_reply, front_len);
+ break;
+ default:
+ return NULL;
}
- return ceph_alloc_msg(con, hdr);
+
+ if (!m)
+ *skip = 1;
+
+ return m;
}
/*
@@ -749,5 +761,4 @@ const static struct ceph_connection_operations mon_con_ops = {
.dispatch = dispatch,
.fault = mon_fault,
.alloc_msg = mon_alloc_msg,
- .alloc_middle = ceph_alloc_middle,
};