[zaptel-commits] tzafrir: trunk r1289 - /trunk/xpp/xpp_zap.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Wed Aug 9 20:26:12 MST 2006


Author: tzafrir
Date: Wed Aug  9 22:26:12 2006
New Revision: 1289

URL: http://svn.digium.com/view/zaptel?rev=1289&view=rev
Log:
Solves spinlock-panic in CentOS 4.

zt_transmit() was called in spinlock protected context. However, it may
call back our hook setting code which tries to lock the same spinlock.

As a safeguard, the same logic was applied to zt_receive().

Modified:
    trunk/xpp/xpp_zap.c

Modified: trunk/xpp/xpp_zap.c
URL: http://svn.digium.com/view/zaptel/trunk/xpp/xpp_zap.c?rev=1289&r1=1288&r2=1289&view=diff
==============================================================================
--- trunk/xpp/xpp_zap.c (original)
+++ trunk/xpp/xpp_zap.c Wed Aug  9 22:26:12 2006
@@ -903,7 +903,13 @@
 	} else {
 		w = writechunk = xpd->writechunk + ZT_CHUNKSIZE * CHANNELS_PERXPD /* + 1 */;
 	}
+	spin_unlock_irqrestore(&xpd->lock, flags);
+	/*
+	 * This should be out of spinlocks, as it may call back our hook setting
+	 * methods
+	 */
 	zt_transmit(&xpd->span);
+	spin_lock_irqsave(&xpd->lock, flags);
 
 	for (i = 0; i < channels; i++) {
 		if (xpd->delay_until_dialtone[i] > 0) {
@@ -1011,8 +1017,12 @@
 		memcpy(xpd->ec_chunk1[i], chans[i].writechunk, ZT_CHUNKSIZE);
 	}
 #endif
+	spin_unlock_irqrestore(&xpd->lock, flags);
+	/*
+	 * This should be out of spinlocks, as it may call back our hook setting
+	 * methods
+	 */
 	zt_receive(&xpd->span);
-	spin_unlock_irqrestore(&xpd->lock, flags);
 }
 
 static int xpp_startup(struct zt_span *span)



More information about the zaptel-commits mailing list