From: Colin Patrick McCabe Date: Wed, 1 Jun 2011 18:37:34 +0000 (-0700) Subject: dout: use recursive mutex for dout X-Git-Tag: v0.30~146 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e340bfe13d4a86d01d1d74b03c538950830d770d;p=ceph.git dout: use recursive mutex for dout Using a recursive mutex for dout is desirable because it allows us to survive situations like this: > foo() { dout << "foo" << dendl; } > dout(0) << foo() << dendl; These cases should be fixed because they produce garbled output. However, with this change, at least they will not cause deadlock. Signed-off-by: Colin McCabe --- diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index b093d7301934..d581dda8c770 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -33,7 +33,7 @@ DoutStreambuf ::traits_type> *_doss(g_ceph_context * The dout lock protects calls to dout() * TODO: needs to become part of CephContext */ -pthread_mutex_t _dout_lock = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t _dout_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; class CephContextServiceThread : public Thread {