Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: [OMPI devel] [PATCH] OSC/RDMA: Fix a potential deadlock
From: Guillaume Thouvenin (guillaume.thouvenin_at_[hidden])
Date: 2010-12-13 08:41:01


Hello,

 This patch fixes a potential loss of a lock request in function
ompi_osc_rdma_passive_unlock_complete(). A new pending request is taken
from the m_locks_pending list. If m_lock_status is not equal to 0, this
new entry is then set to NULL and thus lost. This can lead to a deadlock
situation. So this patch moves the update of new_pending in its right
place.

 This patch was tested on v1.5.

Regards
Guillaume

---
diff --git a/ompi/mca/osc/rdma/osc_rdma_sync.c
b/ompi/mca/osc/rdma/osc_rdma_sync.c ---
a/ompi/mca/osc/rdma/osc_rdma_sync.c +++
b/ompi/mca/osc/rdma/osc_rdma_sync.c @@ -748,9 +748,9 @@
ompi_osc_rdma_passive_unlock_complete(om /* if we were really unlocked,
see if we have another lock request we can satisfy */
     OPAL_THREAD_LOCK(&(module->m_lock));
-    new_pending = (ompi_osc_rdma_pending_lock_t*) 
-        opal_list_remove_first(&(module->m_locks_pending));
     if (0 == module->m_lock_status) {
+        new_pending = (ompi_osc_rdma_pending_lock_t*)
+            opal_list_remove_first(&(module->m_locks_pending));
         if (NULL != new_pending) {
             ompi_win_append_mode(module->m_win, OMPI_WIN_EXPOSE_EPOCH);
             /* set lock state and generate a lock request */