[ofw] [patch][core][al] Acquire the mad_lock before accessing the mad_list in __free_mads
Fab Tillier
ftillier at microsoft.com
Thu Feb 17 07:33:21 PST 2011
You shouldn't need the lock here - think of the 'free' routines as destructors. Any concurrent accesses to this object are highly unsafe. Holding a lock on the list doesn't really help, as something is trying to touch an object that's about to be freed...
What is the scenario under which this is needed?
Thanks,
-Fab
From: ofw-bounces at lists.openfabrics.org [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Irena Gannon
Sent: Thursday, February 17, 2011 5:28 AM
To: 'ofw at lists.openfabrics.org'
Subject: [ofw] [patch][core][al] Acquire the mad_lock before accessing the mad_list in __free_mads
Signed-off-by: Irena Gannon (irena at mellanox.co.il<mailto:irena at mellanox.co.il>)
Acquire the mad_lock before accessing the mad_list in __free_mads
Index: B:/users/irena/proj1/trunk/core/al/al.c
===================================================================
--- B:/users/irena/proj1/trunk/core/al/al.c (revision 6997)
+++ B:/users/irena/proj1/trunk/core/al/al.c (revision 6998)
@@ -132,6 +132,7 @@
ib_api_status_t status;
/* Return all outstanding MADs to their MAD pools. */
+ cl_spinlock_acquire( &h_al->mad_lock);
for( p_list_item = cl_qlist_head( &h_al->mad_list );
p_list_item != cl_qlist_end( &h_al->mad_list );
p_list_item = cl_qlist_head( &h_al->mad_list ) )
@@ -147,6 +148,7 @@
ib_get_err_str(status)) );
}
}
+ cl_spinlock_release( &h_al->mad_lock);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20110217/478cea2e/attachment.html>
More information about the ofw
mailing list