diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2015-03-23 07:52:40 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2015-04-20 11:55:37 -0400 |
commit | 67c64eb742a49d3d3f5dcef75d0c32a3394e5519 (patch) | |
tree | 3ec2a92411b449db348df22d76b1f8f20c05fa4d /net/ceph/messenger.c | |
parent | 1c841a96b5f369cbb0b169d13825c7ff7d0fba8d (diff) |
libceph: don't overwrite specific con error msgs
- specific con->error_msg messages (e.g. "protocol version mismatch")
end up getting overwritten by a catch-all "socket error on read
/ write", introduced in commit 3a140a0d5c4b ("libceph: report socket
read/write error message")
- "bad message sequence # for incoming message" loses to "bad crc" due
to the fact that -EBADMSG is used for both
Fix it, and tidy up con->error_msg assignments and pr_errs while at it.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'net/ceph/messenger.c')
-rw-r--r-- | net/ceph/messenger.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index a9f4ae45b7fb..967080a9f043 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -505,8 +505,6 @@ static int ceph_tcp_connect(struct ceph_connection *con) | |||
505 | pr_err("connect %s error %d\n", | 505 | pr_err("connect %s error %d\n", |
506 | ceph_pr_addr(&con->peer_addr.in_addr), ret); | 506 | ceph_pr_addr(&con->peer_addr.in_addr), ret); |
507 | sock_release(sock); | 507 | sock_release(sock); |
508 | con->error_msg = "connect error"; | ||
509 | |||
510 | return ret; | 508 | return ret; |
511 | } | 509 | } |
512 | 510 | ||
@@ -2145,12 +2143,10 @@ static int process_connect(struct ceph_connection *con) | |||
2145 | * to WAIT. This shouldn't happen if we are the | 2143 | * to WAIT. This shouldn't happen if we are the |
2146 | * client. | 2144 | * client. |
2147 | */ | 2145 | */ |
2148 | pr_err("process_connect got WAIT as client\n"); | ||
2149 | con->error_msg = "protocol error, got WAIT as client"; | 2146 | con->error_msg = "protocol error, got WAIT as client"; |
2150 | return -1; | 2147 | return -1; |
2151 | 2148 | ||
2152 | default: | 2149 | default: |
2153 | pr_err("connect protocol error, will retry\n"); | ||
2154 | con->error_msg = "protocol error, garbage tag during connect"; | 2150 | con->error_msg = "protocol error, garbage tag during connect"; |
2155 | return -1; | 2151 | return -1; |
2156 | } | 2152 | } |
@@ -2282,8 +2278,7 @@ static int read_partial_message(struct ceph_connection *con) | |||
2282 | 2278 | ||
2283 | crc = crc32c(0, &con->in_hdr, offsetof(struct ceph_msg_header, crc)); | 2279 | crc = crc32c(0, &con->in_hdr, offsetof(struct ceph_msg_header, crc)); |
2284 | if (cpu_to_le32(crc) != con->in_hdr.crc) { | 2280 | if (cpu_to_le32(crc) != con->in_hdr.crc) { |
2285 | pr_err("read_partial_message bad hdr " | 2281 | pr_err("read_partial_message bad hdr crc %u != expected %u\n", |
2286 | " crc %u != expected %u\n", | ||
2287 | crc, con->in_hdr.crc); | 2282 | crc, con->in_hdr.crc); |
2288 | return -EBADMSG; | 2283 | return -EBADMSG; |
2289 | } | 2284 | } |
@@ -2313,7 +2308,7 @@ static int read_partial_message(struct ceph_connection *con) | |||
2313 | pr_err("read_partial_message bad seq %lld expected %lld\n", | 2308 | pr_err("read_partial_message bad seq %lld expected %lld\n", |
2314 | seq, con->in_seq + 1); | 2309 | seq, con->in_seq + 1); |
2315 | con->error_msg = "bad message sequence # for incoming message"; | 2310 | con->error_msg = "bad message sequence # for incoming message"; |
2316 | return -EBADMSG; | 2311 | return -EBADE; |
2317 | } | 2312 | } |
2318 | 2313 | ||
2319 | /* allocate message? */ | 2314 | /* allocate message? */ |
@@ -2660,6 +2655,8 @@ more: | |||
2660 | switch (ret) { | 2655 | switch (ret) { |
2661 | case -EBADMSG: | 2656 | case -EBADMSG: |
2662 | con->error_msg = "bad crc"; | 2657 | con->error_msg = "bad crc"; |
2658 | /* fall through */ | ||
2659 | case -EBADE: | ||
2663 | ret = -EIO; | 2660 | ret = -EIO; |
2664 | break; | 2661 | break; |
2665 | case -EIO: | 2662 | case -EIO: |
@@ -2838,7 +2835,8 @@ static void con_work(struct work_struct *work) | |||
2838 | if (ret < 0) { | 2835 | if (ret < 0) { |
2839 | if (ret == -EAGAIN) | 2836 | if (ret == -EAGAIN) |
2840 | continue; | 2837 | continue; |
2841 | con->error_msg = "socket error on read"; | 2838 | if (!con->error_msg) |
2839 | con->error_msg = "socket error on read"; | ||
2842 | fault = true; | 2840 | fault = true; |
2843 | break; | 2841 | break; |
2844 | } | 2842 | } |
@@ -2847,7 +2845,8 @@ static void con_work(struct work_struct *work) | |||
2847 | if (ret < 0) { | 2845 | if (ret < 0) { |
2848 | if (ret == -EAGAIN) | 2846 | if (ret == -EAGAIN) |
2849 | continue; | 2847 | continue; |
2850 | con->error_msg = "socket error on write"; | 2848 | if (!con->error_msg) |
2849 | con->error_msg = "socket error on write"; | ||
2851 | fault = true; | 2850 | fault = true; |
2852 | } | 2851 | } |
2853 | 2852 | ||
@@ -2869,11 +2868,13 @@ static void con_work(struct work_struct *work) | |||
2869 | */ | 2868 | */ |
2870 | static void con_fault(struct ceph_connection *con) | 2869 | static void con_fault(struct ceph_connection *con) |
2871 | { | 2870 | { |
2872 | pr_warn("%s%lld %s %s\n", ENTITY_NAME(con->peer_name), | ||
2873 | ceph_pr_addr(&con->peer_addr.in_addr), con->error_msg); | ||
2874 | dout("fault %p state %lu to peer %s\n", | 2871 | dout("fault %p state %lu to peer %s\n", |
2875 | con, con->state, ceph_pr_addr(&con->peer_addr.in_addr)); | 2872 | con, con->state, ceph_pr_addr(&con->peer_addr.in_addr)); |
2876 | 2873 | ||
2874 | pr_warn("%s%lld %s %s\n", ENTITY_NAME(con->peer_name), | ||
2875 | ceph_pr_addr(&con->peer_addr.in_addr), con->error_msg); | ||
2876 | con->error_msg = NULL; | ||
2877 | |||
2877 | WARN_ON(con->state != CON_STATE_CONNECTING && | 2878 | WARN_ON(con->state != CON_STATE_CONNECTING && |
2878 | con->state != CON_STATE_NEGOTIATING && | 2879 | con->state != CON_STATE_NEGOTIATING && |
2879 | con->state != CON_STATE_OPEN); | 2880 | con->state != CON_STATE_OPEN); |
@@ -3295,8 +3296,8 @@ static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip) | |||
3295 | */ | 3296 | */ |
3296 | if (*skip) | 3297 | if (*skip) |
3297 | return 0; | 3298 | return 0; |
3298 | con->error_msg = "error allocating memory for incoming message"; | ||
3299 | 3299 | ||
3300 | con->error_msg = "error allocating memory for incoming message"; | ||
3300 | return -ENOMEM; | 3301 | return -ENOMEM; |
3301 | } | 3302 | } |
3302 | memcpy(&con->in_msg->hdr, &con->in_hdr, sizeof(con->in_hdr)); | 3303 | memcpy(&con->in_msg->hdr, &con->in_hdr, sizeof(con->in_hdr)); |