[netfilter-cvslog] r3792 -
branches/netfilter-ha/linux-2.6-actact/ct_sync
laforge at netfilter.org
laforge at netfilter.org
Sat Mar 12 15:32:34 CET 2005
Author: laforge at netfilter.org
Date: 2005-03-12 15:32:33 +0100 (Sat, 12 Mar 2005)
New Revision: 3792
Modified:
branches/netfilter-ha/linux-2.6-actact/ct_sync/ct_sync_main.c
Log:
make waitqueues per-instance private data
Modified: branches/netfilter-ha/linux-2.6-actact/ct_sync/ct_sync_main.c
===================================================================
--- branches/netfilter-ha/linux-2.6-actact/ct_sync/ct_sync_main.c 2005-03-12 13:19:49 UTC (rev 3791)
+++ branches/netfilter-ha/linux-2.6-actact/ct_sync/ct_sync_main.c 2005-03-12 14:32:33 UTC (rev 3792)
@@ -78,13 +78,7 @@
static int notrack = 1;
module_param(notrack, int, 0000);
-/* thread wait queue heads */
-static DECLARE_WAIT_QUEUE_HEAD(ct_sync_rcv_wait);
-static DECLARE_WAIT_QUEUE_HEAD(ct_sync_send_wait);
-
-static DECLARE_WAIT_QUEUE_HEAD(ct_sync_initsync_wait);
-
DEFINE_PER_CPU(struct ct_sync_stat, ct_sync_stats);
@@ -121,10 +115,16 @@
struct cts_protoh *protoh; /* protocol handle */
+ /* kernel threads */
struct task_struct *send_thread;
struct task_struct *recv_thread;
struct task_struct *initsync_thread;
+ /* thread wait queue heads */
+ wait_queue_head_t send_wait;
+ wait_queue_head_t recv_wait;
+ wait_queue_head_t initsync_wait;
+
/* sysfs stuff */
struct kobject kobj;
struct cts_inst_attribute state_attr;
@@ -794,7 +794,7 @@
if (cts_proto_is_master(ctsi->protoh) &&
!atomic_read(&ctsi->initsync_active)) {
CTS_STAT_INC(initsyncs);
- wake_up(&ct_sync_initsync_wait);
+ wake_up(&ctsi->initsync_wait);
} else
CT_SYNC_INFO("not master, or initsync already in progress\n");
@@ -807,11 +807,13 @@
* SYSCTL HANDLING
***********************************************************************/
+#ifdef FIXME
/* sysctl variables */
static int cts_sysctl_maxage;
static int recovery_threshold_min = 1;
static int recovery_threshold_max = 32000;
+#endif
#define CTS_SYSCTL_STATE_NONE 0
#define CTS_SYSCTL_STATE_SLAVE 1
@@ -853,10 +855,10 @@
cts_proto_initsync_request(ctsi->protoh);
__set_current_state(TASK_INTERRUPTIBLE);
- add_wait_queue(&ct_sync_send_wait, &wait);
+ add_wait_queue(&ctsi->send_wait, &wait);
CT_SYNC_DEBUG2("falling asleep\n");
remaining = schedule_timeout(HZ);
- remove_wait_queue(&ct_sync_send_wait, &wait);
+ remove_wait_queue(&ctsi->send_wait, &wait);
__set_current_state(TASK_RUNNING);
if (remaining <= 0) {
@@ -885,7 +887,7 @@
/* wait for a new packet to arrive */
if (!cts_proto_recv_pending(ctsi->protoh)) {
__set_current_state(TASK_INTERRUPTIBLE);
- add_wait_queue(&ct_sync_rcv_wait, wait);
+ add_wait_queue(&ctsi->recv_wait, wait);
for (;;) {
__set_current_state(TASK_INTERRUPTIBLE);
@@ -897,7 +899,7 @@
schedule();
}
- remove_wait_queue(&ct_sync_rcv_wait, wait);
+ remove_wait_queue(&ctsi->recv_wait, wait);
__set_current_state(TASK_RUNNING);
}
@@ -1119,9 +1121,9 @@
for (;;) {
__set_current_state(TASK_INTERRUPTIBLE);
- add_wait_queue(&ct_sync_initsync_wait, &wait);
+ add_wait_queue(&ctsi->initsync_wait, &wait);
schedule();
- remove_wait_queue(&ct_sync_initsync_wait, &wait);
+ remove_wait_queue(&ctsi->initsync_wait, &wait);
__set_current_state(TASK_RUNNING);
/* somebody woke us. either initsync or thread termination
@@ -1977,7 +1979,7 @@
/* init protocol layer */
ctsi->protoh = cts_proto_init(&ct_sync_state_transition, NULL,
- &ct_sync_send_wait, &ct_sync_rcv_wait);
+ &ctsi->send_wait, &ctsi->recv_wait);
if (!ctsi->protoh) {
CT_SYNC_ERR("Failed to initialize protocol.\n");
ret = -EINVAL;
@@ -2035,6 +2037,9 @@
if (ret < 0)
goto out_sysfs_recvburst;
#endif
+ init_waitqueue_head(&ctsi->send_wait);
+ init_waitqueue_head(&ctsi->recv_wait);
+ init_waitqueue_head(&ctsi->initsync_wait);
list_add(&ctsi->list, &ct_sync_instances);
write_unlock(&ctsync_lock);
More information about the netfilter-cvslog
mailing list