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: [email protected] 
[mailto:[email protected]] On Behalf Of Irena Gannon
Sent: Thursday, February 17, 2011 5:28 AM
To: '[email protected]'
Subject: [ofw] [patch][core][al] Acquire the mad_lock before accessing the 
mad_list in __free_mads

Signed-off-by: Irena Gannon ([email protected]<mailto:[email protected]>)

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);
 }


_______________________________________________
ofw mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw

Reply via email to