]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
crimson/mgr/client:Introduce Client::send()
authorMatan Breizman <mbreizma@redhat.com>
Sun, 2 Mar 2025 14:33:07 +0000 (14:33 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Wed, 5 Mar 2025 12:26:25 +0000 (12:26 +0000)
commitd3e0ca7ffa8cbb5fd51d1b1ee987bd4e9a6aea21
tree23cb2e89146ef47b617cce7ef916e65c49f9c5c4
parent6e23a1e43beb53f609bdd606ddaab643b27af62f
crimson/mgr/client:Introduce Client::send()

Client::reconnect nullifies the connection used by the mgr client
before setting a new one.

In this time, we might re-use the nullptr connection due to tasks
that are being run in the background (See: dispatch_in_background).

To avoid this, we had multiple `if (!conn)` checks, some methods
even checked this condition twice to reduce the possibilty of using
undefined the connection.

Instead of introducing an additional check in Client::_send_report,
Introduce Client::send which would be responsible for:
a) Veryfing the connection is set
b) Trying to get a shared access to conn_lock

Client::reconnect will lock conn_lock exclusivly until the
connection is set. If we send is called while reconnecting,
sending will be dropped - same as before.

Fixes: https://tracker.ceph.com/issues/70179
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
src/crimson/mgr/client.cc
src/crimson/mgr/client.h