From: Sean Hefty Date: Wed, 23 Feb 2011 17:05:39 +0000 (-0800) Subject: RDMA/cma: Replace global lock in rdma_destroy_id() with id-specific one X-Git-Tag: v2.6.39-rc1~485^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a396d43a35fb91f2d4920a4700d25ecc5ec92404;p=pandora-kernel.git RDMA/cma: Replace global lock in rdma_destroy_id() with id-specific one rdma_destroy_id currently uses the global rdma cm 'lock' to test if an rdma_cm_id has been bound to a device. This prevents an active address resolution callback handler from assigning a device to the rdma_cm_id after rdma_destroy_id checks for one. Instead, we can replace the use of the global lock around the check to the rdma_cm_id device pointer by setting the id state to destroying, then flushing all active callbacks. The latter is accomplished by acquiring and releasing the handler_mutex. Any active handler will complete first, and any newly scheduled handlers will find the rdma_cm_id in an invalid state. In addition to optimizing the current locking scheme, the use of the rdma_cm_id mutex is a more intuitive synchronization mechanism than that of the global lock. These changes are based on feedback from Doug Ledford while he was trying to debug a crash in the rdma cm destroy path. Signed-off-by: Sean Hefty Signed-off-by: Roland Dreier --- Reading git-diff-tree failed