diff options
author | Guanjun He <gjhe@suse.com> | 2012-07-08 19:50:33 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-07-30 09:29:53 -0700 |
commit | a2a3258417eb6a1799cf893350771428875a8287 (patch) | |
tree | f8906aa980d79af72e7e02d5592512a914c4b721 /net/ceph/messenger.c | |
parent | a16cb1f70799c851410d9dca0a24122e258df06c (diff) | |
download | blackbird-op-linux-a2a3258417eb6a1799cf893350771428875a8287.tar.gz blackbird-op-linux-a2a3258417eb6a1799cf893350771428875a8287.zip |
libceph: prevent the race of incoming work during teardown
Add an atomic variable 'stopping' as flag in struct ceph_messenger,
set this flag to 1 in function ceph_destroy_client(), and add the condition code
in function ceph_data_ready() to test the flag value, if true(1), just return.
Signed-off-by: Guanjun He <gjhe@suse.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net/ceph/messenger.c')
-rw-r--r-- | net/ceph/messenger.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 16814d1f4774..63e1252d3af5 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -254,6 +254,9 @@ static void con_sock_state_closed(struct ceph_connection *con) static void ceph_sock_data_ready(struct sock *sk, int count_unused) { struct ceph_connection *con = sk->sk_user_data; + if (atomic_read(&con->msgr->stopping)) { + return; + } if (sk->sk_state != TCP_CLOSE_WAIT) { dout("%s on %p state = %lu, queueing work\n", __func__, @@ -2413,6 +2416,8 @@ void ceph_messenger_init(struct ceph_messenger *msgr, encode_my_addr(msgr); msgr->nocrc = nocrc; + atomic_set(&msgr->stopping, 0); + dout("%s %p\n", __func__, msgr); } EXPORT_SYMBOL(ceph_messenger_init); |