diff options
Diffstat (limited to 'net/ceph/messenger.c')
-rw-r--r-- | net/ceph/messenger.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 0f9933a5a8b0..6ec6051e1672 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -2807,13 +2807,12 @@ static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip) | |||
2807 | int type = le16_to_cpu(hdr->type); | 2807 | int type = le16_to_cpu(hdr->type); |
2808 | int front_len = le32_to_cpu(hdr->front_len); | 2808 | int front_len = le32_to_cpu(hdr->front_len); |
2809 | int middle_len = le32_to_cpu(hdr->middle_len); | 2809 | int middle_len = le32_to_cpu(hdr->middle_len); |
2810 | struct ceph_msg *msg; | ||
2810 | int ret = 0; | 2811 | int ret = 0; |
2811 | 2812 | ||
2812 | BUG_ON(con->in_msg != NULL); | 2813 | BUG_ON(con->in_msg != NULL); |
2813 | 2814 | ||
2814 | if (con->ops->alloc_msg) { | 2815 | if (con->ops->alloc_msg) { |
2815 | struct ceph_msg *msg; | ||
2816 | |||
2817 | mutex_unlock(&con->mutex); | 2816 | mutex_unlock(&con->mutex); |
2818 | msg = con->ops->alloc_msg(con, hdr, skip); | 2817 | msg = con->ops->alloc_msg(con, hdr, skip); |
2819 | mutex_lock(&con->mutex); | 2818 | mutex_lock(&con->mutex); |
@@ -2838,12 +2837,19 @@ static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip) | |||
2838 | } | 2837 | } |
2839 | } | 2838 | } |
2840 | if (!con->in_msg) { | 2839 | if (!con->in_msg) { |
2841 | con->in_msg = ceph_msg_new(type, front_len, GFP_NOFS, false); | 2840 | mutex_unlock(&con->mutex); |
2842 | if (!con->in_msg) { | 2841 | msg = ceph_msg_new(type, front_len, GFP_NOFS, false); |
2842 | mutex_lock(&con->mutex); | ||
2843 | if (!msg) { | ||
2843 | pr_err("unable to allocate msg type %d len %d\n", | 2844 | pr_err("unable to allocate msg type %d len %d\n", |
2844 | type, front_len); | 2845 | type, front_len); |
2845 | return -ENOMEM; | 2846 | return -ENOMEM; |
2846 | } | 2847 | } |
2848 | if (con->state != CON_STATE_OPEN) { | ||
2849 | ceph_msg_put(msg); | ||
2850 | return -EAGAIN; | ||
2851 | } | ||
2852 | con->in_msg = msg; | ||
2847 | con->in_msg->con = con->ops->get(con); | 2853 | con->in_msg->con = con->ops->get(con); |
2848 | BUG_ON(con->in_msg->con == NULL); | 2854 | BUG_ON(con->in_msg->con == NULL); |
2849 | con->in_msg->page_alignment = le16_to_cpu(hdr->data_off); | 2855 | con->in_msg->page_alignment = le16_to_cpu(hdr->data_off); |