diff options
author | Alex Elder <elder@inktank.com> | 2012-05-23 15:35:23 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-07-06 00:14:26 -0400 |
commit | 3ec50d1868a9e0493046400bb1fdd054c7f64ebd (patch) | |
tree | f5a5dbab32b5205f07aa4867a32e4b7bcd823e16 /net | |
parent | bb9e6bba5d8b85b631390f8dbe8a24ae1ff5b48a (diff) |
libceph: clear NEGOTIATING when done
A connection state's NEGOTIATING bit gets set while in CONNECTING
state after we have successfully exchanged a ceph banner and IP
addresses with the connection's peer (the server). But that bit
is not cleared again--at least not until another connection attempt
is initiated.
Instead, clear it as soon as the connection is fully established.
Also, clear it when a socket connection gets prematurely closed
in the midst of establishing a ceph connection (in case we had
reached the point where it was set).
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/ceph/messenger.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index beee382d784e..500207bad5d6 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -1562,6 +1562,7 @@ static int process_connect(struct ceph_connection *con) | |||
1562 | fail_protocol(con); | 1562 | fail_protocol(con); |
1563 | return -1; | 1563 | return -1; |
1564 | } | 1564 | } |
1565 | clear_bit(NEGOTIATING, &con->state); | ||
1565 | clear_bit(CONNECTING, &con->state); | 1566 | clear_bit(CONNECTING, &con->state); |
1566 | con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq); | 1567 | con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq); |
1567 | con->connect_seq++; | 1568 | con->connect_seq++; |
@@ -1951,7 +1952,6 @@ more: | |||
1951 | 1952 | ||
1952 | /* open the socket first? */ | 1953 | /* open the socket first? */ |
1953 | if (con->sock == NULL) { | 1954 | if (con->sock == NULL) { |
1954 | clear_bit(NEGOTIATING, &con->state); | ||
1955 | set_bit(CONNECTING, &con->state); | 1955 | set_bit(CONNECTING, &con->state); |
1956 | 1956 | ||
1957 | con_out_kvec_reset(con); | 1957 | con_out_kvec_reset(con); |
@@ -2190,10 +2190,12 @@ static void con_work(struct work_struct *work) | |||
2190 | mutex_lock(&con->mutex); | 2190 | mutex_lock(&con->mutex); |
2191 | restart: | 2191 | restart: |
2192 | if (test_and_clear_bit(SOCK_CLOSED, &con->flags)) { | 2192 | if (test_and_clear_bit(SOCK_CLOSED, &con->flags)) { |
2193 | if (test_and_clear_bit(CONNECTING, &con->state)) | 2193 | if (test_and_clear_bit(CONNECTING, &con->state)) { |
2194 | clear_bit(NEGOTIATING, &con->state); | ||
2194 | con->error_msg = "connection failed"; | 2195 | con->error_msg = "connection failed"; |
2195 | else | 2196 | } else { |
2196 | con->error_msg = "socket closed"; | 2197 | con->error_msg = "socket closed"; |
2198 | } | ||
2197 | goto fault; | 2199 | goto fault; |
2198 | } | 2200 | } |
2199 | 2201 | ||