<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Julian Anastasov &lt;ja@ssi.bg&gt;

An addition to the last ipvs changes that move
update_defense_level/si_meminfo to keventd:

- ip_vs_random_dropentry now runs in process context and should use _bh
  locks to protect from softirqs

- update_defense_level still needs _bh locks after si_meminfo is called,
  for the same purpose

Signed-off-by: Julian Anastasov &lt;ja@ssi.bg&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 net/ipv4/ipvs/ip_vs_conn.c |    6 +++---
 net/ipv4/ipvs/ip_vs_ctl.c  |    9 ++++++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff -puN net/ipv4/ipvs/ip_vs_conn.c~ipvs-add-and-reorder-bh-locks-after-moving-to-keventd net/ipv4/ipvs/ip_vs_conn.c
--- 25/net/ipv4/ipvs/ip_vs_conn.c~ipvs-add-and-reorder-bh-locks-after-moving-to-keventd	2005-05-06 18:14:19.000000000 -0700
+++ 25-akpm/net/ipv4/ipvs/ip_vs_conn.c	2005-05-06 18:14:19.000000000 -0700
@@ -759,7 +759,7 @@ static inline int todrop_entry(struct ip
 	return 1;
 }
 
-
+/* Called from keventd and must protect itself from softirqs */
 void ip_vs_random_dropentry(void)
 {
 	int idx;
@@ -775,7 +775,7 @@ void ip_vs_random_dropentry(void)
 		/*
 		 *  Lock is actually needed in this loop.
 		 */
-		ct_write_lock(hash);
+		ct_write_lock_bh(hash);
 
 		list_for_each_entry(cp, &amp;ip_vs_conn_tab[hash], c_list) {
 			if (!cp-&gt;cport &amp;&amp; !(cp-&gt;flags &amp; IP_VS_CONN_F_NO_CPORT))
@@ -817,7 +817,7 @@ void ip_vs_random_dropentry(void)
 			}
 			ct_write_lock(hash);
 		}
-		ct_write_unlock(hash);
+		ct_write_unlock_bh(hash);
 	}
 }
 
diff -puN net/ipv4/ipvs/ip_vs_ctl.c~ipvs-add-and-reorder-bh-locks-after-moving-to-keventd net/ipv4/ipvs/ip_vs_ctl.c
--- 25/net/ipv4/ipvs/ip_vs_ctl.c~ipvs-add-and-reorder-bh-locks-after-moving-to-keventd	2005-05-06 18:14:19.000000000 -0700
+++ 25-akpm/net/ipv4/ipvs/ip_vs_ctl.c	2005-05-06 18:14:19.000000000 -0700
@@ -90,7 +90,8 @@ int ip_vs_get_debug_level(void)
 #endif
 
 /*
- *	update_defense_level is called from keventd and from sysctl.
+ *	update_defense_level is called from keventd and from sysctl,
+ *	so it needs to protect itself from softirqs
  */
 static void update_defense_level(void)
 {
@@ -110,6 +111,8 @@ static void update_defense_level(void)
 
 	nomem = (availmem &lt; sysctl_ip_vs_amemthresh);
 
+	local_bh_disable();
+
 	/* drop_entry */
 	spin_lock(&amp;__ip_vs_dropentry_lock);
 	switch (sysctl_ip_vs_drop_entry) {
@@ -206,6 +209,8 @@ static void update_defense_level(void)
 	if (to_change &gt;= 0)
 		ip_vs_protocol_timeout_change(sysctl_ip_vs_secure_tcp&gt;1);
 	write_unlock(&amp;__ip_vs_securetcp_lock);
+
+	local_bh_enable();
 }
 
 
@@ -1360,9 +1365,7 @@ proc_do_defense_mode(ctl_table *table, i
 			/* Restore the correct value */
 			*valp = val;
 		} else {
-			local_bh_disable();
 			update_defense_level();
-			local_bh_enable();
 		}
 	}
 	return rc;
_
</pre></body></html>