From: John Coyle Date: Sat, 26 Mar 2016 03:05:41 +0000 (-0400) Subject: unittest_erasure_code_plugin: fix deadlock caused by locked mutex in cancelled thread X-Git-Tag: v10.1.1~22^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ec79b64f85d553a5cd14a3893eb2d5c382e98206;p=ceph.git unittest_erasure_code_plugin: fix deadlock caused by locked mutex in cancelled thread Added unlock when thread is cancelled. Signed-off-by: John Coyle --- diff --git a/src/test/erasure-code/TestErasureCodePlugin.cc b/src/test/erasure-code/TestErasureCodePlugin.cc index 4691ff6e23dc..5b0518e4e309 100644 --- a/src/test/erasure-code/TestErasureCodePlugin.cc +++ b/src/test/erasure-code/TestErasureCodePlugin.cc @@ -30,13 +30,21 @@ protected: class Thread_factory : public Thread { public: + static void cleanup(void *arg) { + ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance(); + if (instance.lock.is_locked()) + instance.lock.Unlock(); + } + virtual void *entry() { ErasureCodeProfile profile; ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance(); ErasureCodeInterfaceRef erasure_code; + pthread_cleanup_push(cleanup, NULL); instance.factory("hangs", g_conf->erasure_code_dir, profile, &erasure_code, &cerr); + pthread_cleanup_pop(0); return NULL; } };