]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
WorkQueue: add/remove_work_queue methods now thread safe 5536/head
authorJason Dillaman <dillaman@redhat.com>
Mon, 10 Aug 2015 23:10:19 +0000 (19:10 -0400)
committerJason Dillaman <dillaman@redhat.com>
Mon, 10 Aug 2015 23:10:19 +0000 (19:10 -0400)
These methods were not acquiring the ThreadPool lock when
manipulating the work_queue collection.  This was causing
occasional crashes within librbd when opening and closing
images.

Fixes: #12662
Backport: hammer, firefly
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/common/WorkQueue.h

index 300ae7d7d71800a66a95e5938e0dad9b5e35a1e9..ef6991b4569d73395165b82b2bac5c69e175f4ba 100644 (file)
@@ -340,10 +340,12 @@ public:
   
   /// assign a work queue to this thread pool
   void add_work_queue(WorkQueue_* wq) {
+    Mutex::Locker l(_lock);
     work_queues.push_back(wq);
   }
   /// remove a work queue from this thread pool
   void remove_work_queue(WorkQueue_* wq) {
+    Mutex::Locker l(_lock);
     unsigned i = 0;
     while (work_queues[i] != wq)
       i++;