[netfilter-cvslog] r3784 -
branches/netfilter-ha/linux-2.6-actact/ct_sync
laforge at netfilter.org
laforge at netfilter.org
Thu Mar 10 19:23:37 CET 2005
Author: laforge at netfilter.org
Date: 2005-03-10 19:23:37 +0100 (Thu, 10 Mar 2005)
New Revision: 3784
Modified:
branches/netfilter-ha/linux-2.6-actact/ct_sync/ct_sync_proto.c
Log:
ad some more detailed comment about our dirty locking hacks ;)
Modified: branches/netfilter-ha/linux-2.6-actact/ct_sync/ct_sync_proto.c
===================================================================
--- branches/netfilter-ha/linux-2.6-actact/ct_sync/ct_sync_proto.c 2005-03-10 18:23:11 UTC (rev 3783)
+++ branches/netfilter-ha/linux-2.6-actact/ct_sync/ct_sync_proto.c 2005-03-10 18:23:37 UTC (rev 3784)
@@ -241,10 +241,10 @@
/* Initialize an already-allocated csb_ring with 'num' number of cts_buffs,
* each of 'size' size.
*
- * A few words about locking of the rings. The receiver ring's locking is simple,
- * since that is accessed only by our receiver kthread. For the sender ring, we have
- * to use spin_{lock,unlock}_bh(), since that ring is accessed by our conntrack
- * notifier functions as well.
+ * A few words about locking of the rings. The receiver ring's locking is
+ * simple, since that is accessed only by our receiver kthread. For the sender
+ * ring, we have to use spin_{lock,unlock}_bh(), since that ring is accessed by
+ * our conntrack notifier functions as well.
*/
static int
csb_ring_init(struct csb_ring *csr, unsigned int num, unsigned int size,
@@ -688,6 +688,7 @@
return retbuf;
}
+/* are packets pending to be sent? */
int
cts_proto_send_pending(struct cts_protoh *cph)
{
@@ -705,6 +706,7 @@
return ret;
}
+/* dequeue a packet from the ring and send it off */
int
cts_proto_send_dequeue(struct cts_protoh *cph)
{
@@ -725,6 +727,14 @@
csb = (struct cts_buff *) cph->send.ring.sent->next;
spin_unlock_bh(&cph->send.ring.lock);
+
+ /* we can't call sendto() while holding the lock, since it might
+ * sleep. However, I'm convinced it is save to release the lock here,
+ * because:
+ * - there is only one kernel thread dequeuing packets from the csr
+ * - nobody else but this function ever changes seqno and/or
+ * modifies the 'sent' pointer of the csb.
+ */
if (likely(cts_proto_is_master(cph))) {
/* advance_alloc() fills the packet header, but does not
More information about the netfilter-cvslog
mailing list