[Spread-cvs] commit: r395 - in trunk: daemon libspread

jonathan at spread.org jonathan at spread.org
Wed Mar 5 18:46:30 EST 2008


Author: jonathan
Date: 2008-03-05 18:46:29 -0500 (Wed, 05 Mar 2008)
New Revision: 395

Modified:
   trunk/daemon/Changelog
   trunk/libspread/sp.c
Log:
In libspread, fix locking bug with missing Mutex_unlock call for the Mbox_mutex when certain
errors caused a return(). Reported with initial patch by Jan on spread-users.



Modified: trunk/daemon/Changelog
===================================================================
--- trunk/daemon/Changelog	2008-03-05 16:17:20 UTC (rev 394)
+++ trunk/daemon/Changelog	2008-03-05 23:46:29 UTC (rev 395)
@@ -1,3 +1,10 @@
+Wed Mar  5 18:43:58 2008  Jonathan Stanton  <jonathan at cnds.jhu.edu>
+
+	* sp.c (SP_scat_receive,SP_internal_mcast): Fix locking bug 
+	with missing Mutex_unlock call for the Mbox_mutex when certain
+	errors caused a return(). Reported with initial patch by Jan 
+	on spread-users.
+
 Wed Mar  5 11:14:50 2008  Jonathan Stanton  <jonathan at cnds.jhu.edu>
 
 	* CVS_Readme.txt: Fix commandline to checkout spread from svn

Modified: trunk/libspread/sp.c
===================================================================
--- trunk/libspread/sp.c	2008-03-05 16:17:20 UTC (rev 394)
+++ trunk/libspread/sp.c	2008-03-05 23:46:29 UTC (rev 395)
@@ -1138,6 +1138,7 @@
                 if( ses < 0 ){
                     Alarmp( SPLOG_INFO, SESSION, "SP_internal_multicast: Session disappeared on us, possible in threaded apps\n");
                     Mutex_unlock( &Struct_mutex );
+                    Mutex_unlock( &Mbox_mutex[mbox&MAX_MUTEX_MASK][0] );
                     return( CONNECTION_CLOSED );
                 }
                 Sessions[ses].state = SESS_ERROR;
@@ -1162,6 +1163,7 @@
                         if( ses < 0 ){
                             Alarmp( SPLOG_INFO, SESSION, "SP_internal_multicast: Session disappeared on us, possible in threaded apps\n");
                             Mutex_unlock( &Struct_mutex );
+                            Mutex_unlock( &Mbox_mutex[mbox&MAX_MUTEX_MASK][0] );
                             return( CONNECTION_CLOSED );
                         }
                         Sessions[ses].state = SESS_ERROR;
@@ -1281,6 +1283,7 @@
                                 if( ses < 0 ){
                                     Alarmp( SPLOG_INFO, SESSION, "SP_scat_receive: Session disappeared on us, possible in threaded apps\n");
                                     Mutex_unlock( &Struct_mutex );
+                                    Mutex_unlock( &Mbox_mutex[mbox & MAX_MUTEX_MASK][1] );
                                     return( CONNECTION_CLOSED );
                                 }
                                 Sessions[ses].state = SESS_ERROR;
@@ -1430,6 +1433,7 @@
                                 if( ses < 0 ){
                                     Alarmp( SPLOG_INFO, SESSION, "SP_scat_receive: Session disappeared on us, possible in threaded apps\n");
                                     Mutex_unlock( &Struct_mutex );
+                                    Mutex_unlock( &Mbox_mutex[mbox & MAX_MUTEX_MASK][1] );
                                     return( CONNECTION_CLOSED );
                                 }
                                 Sessions[ses].state = SESS_ERROR;
@@ -1469,6 +1473,7 @@
                         if( ses < 0 ){
                             Alarmp( SPLOG_INFO, SESSION, "SP_scat_receive: Session disappeared on us, possible in threaded apps\n");
                             Mutex_unlock( &Struct_mutex );
+                            Mutex_unlock( &Mbox_mutex[mbox & MAX_MUTEX_MASK][1] );
                             return( CONNECTION_CLOSED );
                         }
                         Sessions[ses].state = SESS_ERROR;
@@ -1498,6 +1503,7 @@
                                 if( ses < 0 ){
                                     Alarmp( SPLOG_INFO, SESSION, "SP_scat_receive: Session disappeared on us, possible in threaded apps\n");
                                     Mutex_unlock( &Struct_mutex );
+                                    Mutex_unlock( &Mbox_mutex[mbox & MAX_MUTEX_MASK][1] );
                                     return( CONNECTION_CLOSED );
                                 }
                                 Sessions[ses].state = SESS_ERROR;
@@ -1561,6 +1567,7 @@
                         if( ses < 0 ){
                             Alarmp( SPLOG_INFO, SESSION, "SP_scat_receive: Session disappeared on us, possible in threaded apps\n");
                             Mutex_unlock( &Struct_mutex );
+                            Mutex_unlock( &Mbox_mutex[mbox & MAX_MUTEX_MASK][1] );
                             return( CONNECTION_CLOSED );
                         }
                         Sessions[ses].state = SESS_ERROR;
@@ -1733,6 +1740,7 @@
                                 if( ses < 0 ){
                                     Alarmp( SPLOG_INFO, SESSION, "SP_scat_receive: Session disappeared on us, possible in threaded apps\n");
                                     Mutex_unlock( &Struct_mutex );
+                                    Mutex_unlock( &Mbox_mutex[mbox & MAX_MUTEX_MASK][1] );
                                     return( CONNECTION_CLOSED );
                                 }
                                 Sessions[ses].state = SESS_ERROR;




More information about the Spread-cvs mailing list