diff options
Diffstat (limited to 'fs/ceph/mon_client.c')
-rw-r--r-- | fs/ceph/mon_client.c | 25 |
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) | |||
692 | * Allocate memory for incoming message | 692 | * Allocate memory for incoming message |
693 | */ | 693 | */ |
694 | static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con, | 694 | static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con, |
695 | struct ceph_msg_header *hdr) | 695 | struct ceph_msg_header *hdr, |
696 | int *skip) | ||
696 | { | 697 | { |
697 | struct ceph_mon_client *monc = con->private; | 698 | struct ceph_mon_client *monc = con->private; |
698 | int type = le16_to_cpu(hdr->type); | 699 | int type = le16_to_cpu(hdr->type); |
699 | int front = le32_to_cpu(hdr->front_len); | 700 | int front_len = le32_to_cpu(hdr->front_len); |
701 | struct ceph_msg *m; | ||
700 | 702 | ||
703 | *skip = 0; | ||
701 | switch (type) { | 704 | switch (type) { |
702 | case CEPH_MSG_MON_SUBSCRIBE_ACK: | 705 | case CEPH_MSG_MON_SUBSCRIBE_ACK: |
703 | return ceph_msgpool_get(&monc->msgpool_subscribe_ack, front); | 706 | m = ceph_msgpool_get(&monc->msgpool_subscribe_ack, front_len); |
707 | break; | ||
704 | case CEPH_MSG_STATFS_REPLY: | 708 | case CEPH_MSG_STATFS_REPLY: |
705 | return ceph_msgpool_get(&monc->msgpool_statfs_reply, front); | 709 | m = ceph_msgpool_get(&monc->msgpool_statfs_reply, front_len); |
710 | break; | ||
706 | case CEPH_MSG_AUTH_REPLY: | 711 | case CEPH_MSG_AUTH_REPLY: |
707 | return ceph_msgpool_get(&monc->msgpool_auth_reply, front); | 712 | m = ceph_msgpool_get(&monc->msgpool_auth_reply, front_len); |
713 | break; | ||
714 | default: | ||
715 | return NULL; | ||
708 | } | 716 | } |
709 | return ceph_alloc_msg(con, hdr); | 717 | |
718 | if (!m) | ||
719 | *skip = 1; | ||
720 | |||
721 | return m; | ||
710 | } | 722 | } |
711 | 723 | ||
712 | /* | 724 | /* |
@@ -749,5 +761,4 @@ const static struct ceph_connection_operations mon_con_ops = { | |||
749 | .dispatch = dispatch, | 761 | .dispatch = dispatch, |
750 | .fault = mon_fault, | 762 | .fault = mon_fault, |
751 | .alloc_msg = mon_alloc_msg, | 763 | .alloc_msg = mon_alloc_msg, |
752 | .alloc_middle = ceph_alloc_middle, | ||
753 | }; | 764 | }; |