diff options
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/messenger.c | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 5e67be3fa296..32a3a2a72580 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -1559,7 +1559,6 @@ static int process_connect(struct ceph_connection *con) | |||
1559 | return -1; | 1559 | return -1; |
1560 | } | 1560 | } |
1561 | clear_bit(NEGOTIATING, &con->state); | 1561 | clear_bit(NEGOTIATING, &con->state); |
1562 | clear_bit(CONNECTING, &con->state); | ||
1563 | set_bit(CONNECTED, &con->state); | 1562 | set_bit(CONNECTED, &con->state); |
1564 | con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq); | 1563 | con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq); |
1565 | con->connect_seq++; | 1564 | con->connect_seq++; |
@@ -2000,7 +1999,8 @@ more_kvec: | |||
2000 | } | 1999 | } |
2001 | 2000 | ||
2002 | do_next: | 2001 | do_next: |
2003 | if (!test_bit(CONNECTING, &con->state)) { | 2002 | if (!test_bit(CONNECTING, &con->state) && |
2003 | !test_bit(NEGOTIATING, &con->state)) { | ||
2004 | /* is anything else pending? */ | 2004 | /* is anything else pending? */ |
2005 | if (!list_empty(&con->out_queue)) { | 2005 | if (!list_empty(&con->out_queue)) { |
2006 | prepare_write_message(con); | 2006 | prepare_write_message(con); |
@@ -2057,25 +2057,29 @@ more: | |||
2057 | } | 2057 | } |
2058 | 2058 | ||
2059 | if (test_bit(CONNECTING, &con->state)) { | 2059 | if (test_bit(CONNECTING, &con->state)) { |
2060 | if (!test_bit(NEGOTIATING, &con->state)) { | 2060 | dout("try_read connecting\n"); |
2061 | dout("try_read connecting\n"); | 2061 | ret = read_partial_banner(con); |
2062 | ret = read_partial_banner(con); | 2062 | if (ret <= 0) |
2063 | if (ret <= 0) | ||
2064 | goto out; | ||
2065 | ret = process_banner(con); | ||
2066 | if (ret < 0) | ||
2067 | goto out; | ||
2068 | |||
2069 | /* Banner is good, exchange connection info */ | ||
2070 | ret = prepare_write_connect(con); | ||
2071 | if (ret < 0) | ||
2072 | goto out; | ||
2073 | prepare_read_connect(con); | ||
2074 | set_bit(NEGOTIATING, &con->state); | ||
2075 | |||
2076 | /* Send connection info before awaiting response */ | ||
2077 | goto out; | 2063 | goto out; |
2078 | } | 2064 | ret = process_banner(con); |
2065 | if (ret < 0) | ||
2066 | goto out; | ||
2067 | |||
2068 | clear_bit(CONNECTING, &con->state); | ||
2069 | set_bit(NEGOTIATING, &con->state); | ||
2070 | |||
2071 | /* Banner is good, exchange connection info */ | ||
2072 | ret = prepare_write_connect(con); | ||
2073 | if (ret < 0) | ||
2074 | goto out; | ||
2075 | prepare_read_connect(con); | ||
2076 | |||
2077 | /* Send connection info before awaiting response */ | ||
2078 | goto out; | ||
2079 | } | ||
2080 | |||
2081 | if (test_bit(NEGOTIATING, &con->state)) { | ||
2082 | dout("try_read negotiating\n"); | ||
2079 | ret = read_partial_connect(con); | 2083 | ret = read_partial_connect(con); |
2080 | if (ret <= 0) | 2084 | if (ret <= 0) |
2081 | goto out; | 2085 | goto out; |
@@ -2197,12 +2201,12 @@ restart: | |||
2197 | if (test_and_clear_bit(SOCK_CLOSED, &con->flags)) { | 2201 | if (test_and_clear_bit(SOCK_CLOSED, &con->flags)) { |
2198 | if (test_and_clear_bit(CONNECTED, &con->state)) | 2202 | if (test_and_clear_bit(CONNECTED, &con->state)) |
2199 | con->error_msg = "socket closed"; | 2203 | con->error_msg = "socket closed"; |
2200 | else if (test_and_clear_bit(CONNECTING, &con->state)) { | 2204 | else if (test_and_clear_bit(NEGOTIATING, &con->state)) |
2201 | clear_bit(NEGOTIATING, &con->state); | 2205 | con->error_msg = "negotiation failed"; |
2206 | else if (test_and_clear_bit(CONNECTING, &con->state)) | ||
2202 | con->error_msg = "connection failed"; | 2207 | con->error_msg = "connection failed"; |
2203 | } else { | 2208 | else |
2204 | con->error_msg = "unrecognized con state"; | 2209 | con->error_msg = "unrecognized con state"; |
2205 | } | ||
2206 | goto fault; | 2210 | goto fault; |
2207 | } | 2211 | } |
2208 | 2212 | ||