[ofa-general] [PATCH] opensm/osm_sminfo_rcv.c: improve locking

Sasha Khapyorsky sashak at voltaire.com
Thu Jul 31 00:49:15 PDT 2008


Minor locking improvement.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/osm_sminfo_rcv.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/opensm/opensm/osm_sminfo_rcv.c b/opensm/opensm/osm_sminfo_rcv.c
index ec8e4de..47c346d 100644
--- a/opensm/opensm/osm_sminfo_rcv.c
+++ b/opensm/opensm/osm_sminfo_rcv.c
@@ -179,22 +179,19 @@ __osm_sminfo_rcv_process_set_request(IN osm_sm_t * sm,
 
 	CL_ASSERT(p_madw);
 
-	/* No real need to grab the lock for this function. */
 	memset(payload, 0, sizeof(payload));
 
-	/* get the lock */
-	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
-
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 	sm_smi = ib_smp_get_payload_ptr(p_smp);
 
 	if (p_smp->method != IB_MAD_METHOD_SET) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F03: "
 			"Unsupported method 0x%X\n", p_smp->method);
-		CL_PLOCK_RELEASE(sm->p_lock);
 		goto Exit;
 	}
 
+	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
+
 	p_smi->guid = sm->p_subn->sm_port_guid;
 	p_smi->act_count = cl_hton32(sm->p_subn->p_osm->stats.qp0_mads_sent);
 	p_smi->pri_state = (uint8_t) (sm->p_subn->sm_state |
-- 
1.5.5.1.178.g1f811




More information about the general mailing list