diff options
Diffstat (limited to 'net/ceph/messenger.c')
-rw-r--r-- | net/ceph/messenger.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index c7d427876dbc..af0c35d40048 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -2819,18 +2819,21 @@ static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip) | |||
2819 | ceph_msg_put(msg); | 2819 | ceph_msg_put(msg); |
2820 | return -EAGAIN; | 2820 | return -EAGAIN; |
2821 | } | 2821 | } |
2822 | con->in_msg = msg; | 2822 | if (msg) { |
2823 | if (con->in_msg) { | 2823 | BUG_ON(*skip); |
2824 | con->in_msg = msg; | ||
2824 | con->in_msg->con = con->ops->get(con); | 2825 | con->in_msg->con = con->ops->get(con); |
2825 | BUG_ON(con->in_msg->con == NULL); | 2826 | BUG_ON(con->in_msg->con == NULL); |
2826 | } | 2827 | } else { |
2827 | if (*skip) { | 2828 | /* |
2828 | con->in_msg = NULL; | 2829 | * Null message pointer means either we should skip |
2829 | return 0; | 2830 | * this message or we couldn't allocate memory. The |
2830 | } | 2831 | * former is not an error. |
2831 | if (!con->in_msg) { | 2832 | */ |
2832 | con->error_msg = | 2833 | if (*skip) |
2833 | "error allocating memory for incoming message"; | 2834 | return 0; |
2835 | con->error_msg = "error allocating memory for incoming message"; | ||
2836 | |||
2834 | return -ENOMEM; | 2837 | return -ENOMEM; |
2835 | } | 2838 | } |
2836 | memcpy(&con->in_msg->hdr, &con->in_hdr, sizeof(con->in_hdr)); | 2839 | memcpy(&con->in_msg->hdr, &con->in_hdr, sizeof(con->in_hdr)); |