Skip to content

msgr/async: fix unsafe access in unregister_conn() - #40912

Merged
tchaikov merged 1 commit into
ceph:masterfrom
liewegas:fix-bug-49237
Apr 22, 2021
Merged

tchaikov merged 1 commit into
ceph:masterfrom
liewegas:fix-bug-49237

Conversation

@liewegas

Copy link
Copy Markdown
Member

We were looking at anon_conns and accepting_conns without holding
the lock (deleted_lock is not sufficient).

Drop this test.

Replace all of the active_connections count updates with a set() set
conns.size() + anon_conns.size() (size() is cheap on a set<>) and the
invariant is clear and easy to maintain.

Fixes: https://tracker.ceph.com/issues/49237
Signed-off-by: Sage Weil [email protected]

@github-actions github-actions Bot added the core label Apr 19, 2021
We were looking at anon_conns and accepting_conns without holding
the lock (deleted_lock is not sufficient).

Drop this test, and move the decrements:

- inc when we add to conns or anon_conns (no changes there)
- dec when we remove from deleted_conns (several different paths!)

Fixes: https://tracker.ceph.com/issues/49237
Signed-off-by: Sage Weil <[email protected]>

@majianpeng majianpeng left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread src/msg/async/AsyncMessenger.cc Resolved
@tchaikov
tchaikov merged commit 0fee244 into ceph:master Apr 22, 2021
@batrick

batrick commented May 3, 2021

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants