]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: call notify completion only once
authorSage Weil <sage@redhat.com>
Mon, 16 Nov 2015 16:32:34 +0000 (11:32 -0500)
committerSage Weil <sage@redhat.com>
Mon, 23 Nov 2015 13:38:51 +0000 (08:38 -0500)
If we race with a reconnect we could get a second notify message
before the notify linger op is torn down.  Ensure we only ever
call the notify completion once to prevent a segfault.

Fixes: #13805
Signed-off-by: Sage Weil <sage@redhat.com>
src/osdc/Objecter.cc

index 13bc16920013a3c97fd9740a2a7e236bcab44513..b70964c71c9480a82e102ea420b6afe223ef2216 100644 (file)
@@ -822,10 +822,13 @@ void Objecter::handle_watch_notify(MWatchNotify *m)
        info->notify_id != m->notify_id) {
       ldout(cct, 10) << __func__ << " reply notify " << m->notify_id
                     << " != " << info->notify_id << ", ignoring" << dendl;
-    } else {
-      assert(info->on_notify_finish);
+    } else if (info->on_notify_finish) {
       info->notify_result_bl->claim(m->get_data());
       info->on_notify_finish->complete(m->return_code);
+
+      // if we race with reconnect we might get a second notify; only
+      // notify the caller once!
+      info->on_notify_finish = NULL;
     }
   } else {
     finisher->queue(new C_DoWatchNotify(this, info, m));