From 38b9c0b2fbbb056c29cd0485a9831edce020eaa6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 16 Nov 2015 11:32:34 -0500 Subject: [PATCH] osdc/Objecter: call notify completion only once 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 (cherry picked from commit 987f68a8df292668ad241f4769d82792644454dd) --- src/osdc/Objecter.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 2b5a979f8239..9bdbe5aafa96 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -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)); -- 2.47.3