]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: disconnect_session_watches obc might not be valid after we relock
authorSamuel Just <sam.just@inktank.com>
Thu, 13 Dec 2012 18:50:52 +0000 (10:50 -0800)
committerSamuel Just <sam.just@inktank.com>
Thu, 13 Dec 2012 18:52:52 +0000 (10:52 -0800)
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>
src/osd/OSD.cc

index ea96c327ba2f1aab446dc3e3827e854c9888b8c5..2dedaf4049ba04f40b489133c090af12ec546177 100644 (file)
@@ -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. */