summaryrefslogtreecommitdiff
path: root/net/ceph/messenger.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-06-20 21:53:53 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-11-26 11:38:27 -0800
commit70b06043cd9aebf15319ce3917196ff032dc20dd (patch)
treefc9b36a43c1ac3b6cc2f2756a5e0129eac47b03f /net/ceph/messenger.c
parent54942c5326f039a40c407a251175cd3925ce2951 (diff)
downloadlinux-3.10-70b06043cd9aebf15319ce3917196ff032dc20dd.tar.gz
linux-3.10-70b06043cd9aebf15319ce3917196ff032dc20dd.tar.bz2
linux-3.10-70b06043cd9aebf15319ce3917196ff032dc20dd.zip
libceph: just set SOCK_CLOSED when state changes
(cherry picked from commit d65c9e0b9eb43d14ece9dd843506ccba06162ee7) When a TCP_CLOSE or TCP_CLOSE_WAIT event occurs, the SOCK_CLOSED connection flag bit is set, and if it had not been previously set queue_con() is called to ensure con_work() will get a chance to handle the changed state. con_work() atomically checks--and if set, clears--the SOCK_CLOSED bit if it was set. This means that even if the bit were set repeatedly, the related processing in con_work() only gets called once per transition of the bit from 0 to 1. What's important then is that we ensure con_work() gets called *at least* once when a socket close event occurs, not that it gets called *exactly* once. The work queue mechanism already takes care of queueing work only if it is not already queued, so there's no need for us to call queue_con() conditionally. So this patch just makes it so the SOCK_CLOSED flag gets set unconditionally in ceph_sock_state_change(). Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/ceph/messenger.c')
-rw-r--r--net/ceph/messenger.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index ed922b7c05b..f8ca57805b1 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -261,8 +261,8 @@ static void ceph_sock_state_change(struct sock *sk)
case TCP_CLOSE_WAIT:
dout("%s TCP_CLOSE_WAIT\n", __func__);
con_sock_state_closing(con);
- if (!test_and_set_bit(SOCK_CLOSED, &con->flags))
- queue_con(con);
+ set_bit(SOCK_CLOSED, &con->flags);
+ queue_con(con);
break;
case TCP_ESTABLISHED:
dout("%s TCP_ESTABLISHED\n", __func__);