Skip to content

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

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

msgr/async: fix unsafe access in unregister_conn()#40912
tchaikov merged 1 commit intoceph:masterfrom
liewegas:fix-bug-49237

Conversation

@liewegas
Copy link
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 sage@newdream.net

@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 <sage@newdream.net>
Copy link
Member

@majianpeng majianpeng left a comment

Choose a reason for hiding this comment

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

LGTM

@tchaikov tchaikov merged commit 0fee244 into ceph:master Apr 22, 2021
@batrick
Copy link
Member

batrick commented May 3, 2021

Causes a regression apparently: https://tracker.ceph.com/issues/50622

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