]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: call notify completion only once 7992/head
authorSage Weil <sage@redhat.com>
Mon, 16 Nov 2015 16:32:34 +0000 (11:32 -0500)
committerNathan Cutler <ncutler@suse.com>
Wed, 9 Mar 2016 03:42:55 +0000 (04:42 +0100)
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>
(cherry picked from commit 987f68a8df292668ad241f4769d82792644454dd)

src/osdc/Objecter.cc

index 2b5a979f8239097658bacb7ec3ad1280bbe662eb..9bdbe5aafa96d14a814394e983be520576a2b036 100644 (file)
@@ -801,10 +801,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));