From: Jason Dillaman Date: Tue, 24 Feb 2015 00:45:03 +0000 (-0500) Subject: osdc: watch error callback invoked on cancelled context X-Git-Tag: v0.93~12^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9c03750acdf8f7dd5901c0f2e0f7d7f8c14ff3d7;p=ceph.git osdc: watch error callback invoked on cancelled context The C_DoWatchError context did not verify whether or not the watch was cancelled prior to invoking the callback. This resulted in sporadic crashes when reconnect errors bubbled up to destroyed objects. Signed-off-by: Jason Dillaman --- diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index d9e57ecd2dcc..abcfafbe08ae 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -491,7 +491,14 @@ struct C_DoWatchError : public Context { info->_queued_async(); } void finish(int r) { - info->watch_context->handle_error(info->get_cookie(), err); + objecter->rwlock.get_read(); + bool canceled = info->canceled; + objecter->rwlock.put_read(); + + if (!canceled) { + info->watch_context->handle_error(info->get_cookie(), err); + } + info->finished_async(); info->put(); objecter->_linger_callback_finish();