Mesa (master): pipebuffer/debug: Fix a recursive mutex lock

Thomas Hellstrom thomash at kemper.freedesktop.org
Mon Oct 31 12:28:54 UTC 2011


Module: Mesa
Branch: master
Commit: 037e7a68f504f019b409ec8cb92f0075019a90f5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=037e7a68f504f019b409ec8cb92f0075019a90f5

Author: Thomas Hellstrom <thellstrom at vmware.com>
Date:   Mon Oct 31 12:14:05 2011 +0100

pipebuffer/debug: Fix a recursive mutex lock

pb_debug_manager_dump was trying to take a lock already
held by all callers.

Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
Signed-off-by: José Fonseca <jfonseca at vmware.com>

---

 src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
index b923735..2ea63d6 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
@@ -339,13 +339,11 @@ pb_debug_buffer_vtbl = {
 
 
 static void
-pb_debug_manager_dump(struct pb_debug_manager *mgr)
+pb_debug_manager_dump_locked(struct pb_debug_manager *mgr)
 {
    struct list_head *curr, *next;
    struct pb_debug_buffer *buf;
 
-   pipe_mutex_lock(mgr->mutex);
-      
    curr = mgr->list.next;
    next = curr->next;
    while(curr != &mgr->list) {
@@ -359,7 +357,6 @@ pb_debug_manager_dump(struct pb_debug_manager *mgr)
       next = curr->next;
    }
 
-   pipe_mutex_unlock(mgr->mutex);
 }
 
 
@@ -394,7 +391,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
       pipe_mutex_lock(mgr->mutex);
       debug_printf("%s: failed to create buffer\n", __FUNCTION__);
       if(!LIST_IS_EMPTY(&mgr->list))
-         pb_debug_manager_dump(mgr);
+         pb_debug_manager_dump_locked(mgr);
       pipe_mutex_unlock(mgr->mutex);
 #endif
       return NULL;
@@ -448,7 +445,7 @@ pb_debug_manager_destroy(struct pb_manager *_mgr)
    pipe_mutex_lock(mgr->mutex);
    if(!LIST_IS_EMPTY(&mgr->list)) {
       debug_printf("%s: unfreed buffers\n", __FUNCTION__);
-      pb_debug_manager_dump(mgr);
+      pb_debug_manager_dump_locked(mgr);
    }
    pipe_mutex_unlock(mgr->mutex);
    




More information about the mesa-commit mailing list