diff options
author | Sage Weil <sage@inktank.com> | 2012-06-27 15:31:02 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-07-06 00:14:39 -0400 |
commit | fbb85a478f6d4cce6942f1c25c6a68ec5b1e7e7f (patch) | |
tree | cc8ade79a548b2373f045e36c2711348119e6460 /net/ceph/messenger.c | |
parent | 735a72ef952d42a256f79ae3e6dc1c17a45c041b (diff) |
libceph: allow sock transition from CONNECTING to CLOSED
It is possible to close a socket that is in the OPENING state. For
example, it can happen if ceph_con_close() is called on the con before
the TCP connection is established. con_work() will come around and shut
down the socket.
Signed-off-by: Sage Weil <sage@inktank.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 ae082d95fc72..09ada7924874 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -48,17 +48,17 @@ | |||
48 | * | ---------------------- | 48 | * | ---------------------- |
49 | * | \ | 49 | * | \ |
50 | * + con_sock_state_closed() \ | 50 | * + con_sock_state_closed() \ |
51 | * |\ \ | 51 | * |+--------------------------- \ |
52 | * | \ \ | 52 | * | \ \ \ |
53 | * | ----------- \ | 53 | * | ----------- \ \ |
54 | * | | CLOSING | socket event; \ | 54 | * | | CLOSING | socket event; \ \ |
55 | * | ----------- await close \ | 55 | * | ----------- await close \ \ |
56 | * | ^ | | 56 | * | ^ \ | |
57 | * | | | | 57 | * | | \ | |
58 | * | + con_sock_state_closing() | | 58 | * | + con_sock_state_closing() \ | |
59 | * | / \ | | 59 | * | / \ | | |
60 | * | / --------------- | | 60 | * | / --------------- | | |
61 | * | / \ v | 61 | * | / \ v v |
62 | * | / -------------- | 62 | * | / -------------- |
63 | * | / -----------------| CONNECTING | socket created, TCP | 63 | * | / -----------------| CONNECTING | socket created, TCP |
64 | * | | / -------------- connect initiated | 64 | * | | / -------------- connect initiated |
@@ -241,7 +241,8 @@ static void con_sock_state_closed(struct ceph_connection *con) | |||
241 | 241 | ||
242 | old_state = atomic_xchg(&con->sock_state, CON_SOCK_STATE_CLOSED); | 242 | old_state = atomic_xchg(&con->sock_state, CON_SOCK_STATE_CLOSED); |
243 | if (WARN_ON(old_state != CON_SOCK_STATE_CONNECTED && | 243 | if (WARN_ON(old_state != CON_SOCK_STATE_CONNECTED && |
244 | old_state != CON_SOCK_STATE_CLOSING)) | 244 | old_state != CON_SOCK_STATE_CLOSING && |
245 | old_state != CON_SOCK_STATE_CONNECTING)) | ||
245 | printk("%s: unexpected old state %d\n", __func__, old_state); | 246 | printk("%s: unexpected old state %d\n", __func__, old_state); |
246 | } | 247 | } |
247 | 248 | ||