summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2012-12-13 10:50:52 -0800
committerSamuel Just <sam.just@inktank.com>2012-12-13 10:52:52 -0800
commitf2c083efd55b92402535841e424dda3ebd3d39c9 (patch)
tree8b5fb7d6f862016475b31ba4ad84d737ea70813d
parentdba096073ab0dbc35ec214b4c12d5f0e11f14489 (diff)
downloadceph-f2c083efd55b92402535841e424dda3ebd3d39c9.tar.gz
OSD: disconnect_session_watches obc might not be valid after we relock
If disconnect_session_watches races with watch removal, the session might no longer have a valid obc ref. In that case, move on to the next obc. Note, there is no danger of any obcs being *added* to the session since the session/connection at this point is dead. Signed-off-by: Samuel Just <sam.just@inktank.com>
-rw-r--r--src/osd/OSD.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index ea96c327ba2..2dedaf4049b 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -2438,6 +2438,14 @@ void OSD::disconnect_session_watches(Session *session)
continue;
}
service.watch_lock.Lock();
+
+ if (!session->watches.count((void*)obc)) {
+ // Raced with watch removal, obc is invalid
+ service.watch_lock.Unlock();
+ pg->unlock();
+ continue;
+ }
+
/* NOTE! fix this one, should be able to just lookup entity name,
however, we currently only keep EntityName on the session and not
entity_name_t. */