]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
msg/async/ProtocolV2: use shared_ptr to manage auth_meta
authorSage Weil <sage@redhat.com>
Tue, 29 Jan 2019 17:57:55 +0000 (11:57 -0600)
committerSage Weil <sage@redhat.com>
Thu, 7 Feb 2019 18:10:33 +0000 (12:10 -0600)
commit87a991cc28a7cf8d6722962add1cc67e959996e7
tree146c109a575b73d13dc21d0aa60cbf58bc2ecc9a
parent160b54da8008c1fb3cca15f99c38d3885a4cd82f
msg/async/ProtocolV2: use shared_ptr to manage auth_meta

When we reconnect a session, we need to move the new connection's auth_meta
over to the existing connection.  However, the existing connection may
have a thread that is unlocked and calling into an AuthClient or AuthServer
method making good use of the old auth_meta.

Resolved this by making auth_meta a shared_ptr and taking a local ref
before dropping the connection lock.  This way we are free to move the
auth_meta over to the new connection as long as we are holding the lock,
and at the same time the existing connection can fiddle with the old
auth_meta without being disturbed.  (That old auth_meta is about to get
discarded, but we still need to prevent the two threads from stomping on
each other.)

This also cleans up the reset_recv_state() a bit since we can simply
replace the old auth_meta with a totally fresh one without worrying about
what kind of state might be lurking in there.

Signed-off-by: Sage Weil <sage@redhat.com>
src/msg/async/Protocol.cc
src/msg/async/Protocol.h
src/msg/async/ProtocolV2.cc