Skip to content

Commit

Permalink
osd: fix session leak when waiting on map
Browse files Browse the repository at this point in the history
We don't want to leak the Session if this Session is already waiting on
a map.

Introduced by eb30f88.

Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
Sage Weil committed Jul 7, 2014
1 parent 17ad083 commit aefbac5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/osd/OSD.h
Original file line number Diff line number Diff line change
Expand Up @@ -1166,8 +1166,10 @@ class OSD : public Dispatcher,
}
void register_session_waiting_on_map(Session *session) {
Mutex::Locker l(session_waiting_for_map_lock);
session->get();
session_waiting_for_map.insert(session);
if (session_waiting_for_map.count(session) == 0) {
session->get();
session_waiting_for_map.insert(session);
}
}
void clear_session_waiting_on_map(Session *session) {
Mutex::Locker l(session_waiting_for_map_lock);
Expand Down

0 comments on commit aefbac5

Please sign in to comment.