]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
dout: use recursive mutex for dout
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 1 Jun 2011 18:37:34 +0000 (11:37 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Wed, 1 Jun 2011 18:42:49 +0000 (11:42 -0700)
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 <colin.mccabe@dreamhost.com>
src/common/ceph_context.cc

index b093d730193437a61e0954618af9143b597aad39..d581dda8c7700bf916fefeae6531915a511a74e1 100644 (file)
@@ -33,7 +33,7 @@ DoutStreambuf <char, std::basic_string<char>::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
 {