netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [2.6 PATCH] ipvs - two additional minor patches
@ 2003-10-05 12:41 Wensong Zhang
  2003-10-05 14:39 ` David S. Miller
  2003-10-05 14:50 ` David S. Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Wensong Zhang @ 2003-10-05 12:41 UTC (permalink / raw)
  To: David S. Miller; +Cc: Rusty Russell, Julian Anastasov, netdev

[-- Attachment #1: Type: TEXT/PLAIN, Size: 373 bytes --]



Hi,

Here are two additional minor patches for IPVS in the kernel 2.6.

The ip_vs_conn_unlock.patch is to fix the unlocking bug in the 
ip_vs_conn_seq_stop, otherwise listing connections would cause the system 
lock up.

The ip_vs_procfs.patch is to the #ifdef CONFIG_PROC_FS macro for proc file 
creation/destruction.

Please consider to include them.

Thanks,

Wensong

[-- Attachment #2: Type: TEXT/PLAIN, Size: 994 bytes --]

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1386  -> 1.1387 
#	net/ipv4/ipvs/ip_vs_conn.c	1.10    -> 1.11   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/10/04	wensong@linux-vs.org	1.1387
# [IPVS] fix the unlocking bug in the ip_vs_conn_seq_stop
# --------------------------------------------
#
diff -Nru a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c
--- a/net/ipv4/ipvs/ip_vs_conn.c	Sat Oct  4 22:54:58 2003
+++ b/net/ipv4/ipvs/ip_vs_conn.c	Sat Oct  4 22:54:58 2003
@@ -670,8 +670,8 @@
 {
 	struct list_head *l = seq->private;
 
-	if (l) 
-		ct_read_unlock(l - ip_vs_conn_tab);
+	if (l)
+		ct_read_unlock_bh(l - ip_vs_conn_tab);
 }
 
 static int ip_vs_conn_seq_show(struct seq_file *seq, void *v)

[-- Attachment #3: Type: TEXT/PLAIN, Size: 7038 bytes --]

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1387  -> 1.1388 
#	net/ipv4/ipvs/ip_vs_app.c	1.7     -> 1.8    
#	net/ipv4/ipvs/ip_vs_ctl.c	1.10    -> 1.11   
#	net/ipv4/ipvs/ip_vs_conn.c	1.11    -> 1.12   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/10/04	wensong@linux-vs.org	1.1388
# [IPVS] add the #ifdef CONFIG_PROC_FS macro for proc file creation/destruction
# --------------------------------------------
#
diff -Nru a/net/ipv4/ipvs/ip_vs_app.c b/net/ipv4/ipvs/ip_vs_app.c
--- a/net/ipv4/ipvs/ip_vs_app.c	Sat Oct  4 22:55:34 2003
+++ b/net/ipv4/ipvs/ip_vs_app.c	Sat Oct  4 22:55:34 2003
@@ -652,13 +652,17 @@
 
 int ip_vs_app_init(void)
 {
+#ifdef CONFIG_PROC_FS
 	/* we will replace it with proc_net_ipvs_create() soon */
 	proc_net_fops_create("ip_vs_app", 0, &ip_vs_app_fops);
+#endif
 	return 0;
 }
 
 
 void ip_vs_app_cleanup(void)
 {
+#ifdef CONFIG_PROC_FS
 	proc_net_remove("ip_vs_app");
+#endif
 }
diff -Nru a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c
--- a/net/ipv4/ipvs/ip_vs_conn.c	Sat Oct  4 22:55:34 2003
+++ b/net/ipv4/ipvs/ip_vs_conn.c	Sat Oct  4 22:55:34 2003
@@ -616,7 +616,7 @@
 {
 	int idx;
 	struct ip_vs_conn *cp;
-	
+
 	for(idx = 0; idx < IP_VS_CONN_TAB_SIZE; idx++) {
 		ct_read_lock_bh(idx);
 		list_for_each_entry(cp, &ip_vs_conn_tab[idx], c_list) {
@@ -634,7 +634,7 @@
 static void *ip_vs_conn_seq_start(struct seq_file *seq, loff_t *pos)
 {
 	seq->private = NULL;
-	return *pos ? ip_vs_conn_array(seq, *pos - 1) :SEQ_START_TOKEN;
+	return *pos ? ip_vs_conn_array(seq, *pos - 1) : SEQ_START_TOKEN;
 }
 
 static void *ip_vs_conn_seq_next(struct seq_file *seq, void *v, loff_t *pos)
@@ -644,7 +644,7 @@
 	int idx;
 
 	++*pos;
-	if (v == SEQ_START_TOKEN) 
+	if (v == SEQ_START_TOKEN)
 		return ip_vs_conn_array(seq, 0);
 
 	/* more on same hash chain? */
@@ -659,7 +659,7 @@
 		list_for_each_entry(cp, &ip_vs_conn_tab[idx], c_list) {
 			seq->private = &ip_vs_conn_tab[idx];
 			return cp;
-		}	
+		}
 		ct_read_unlock_bh(idx);
 	}
 	seq->private = NULL;
@@ -679,18 +679,18 @@
 
 	if (v == SEQ_START_TOKEN)
 		seq_puts(seq,
-   "Pro FromIP   FPrt ToIP     TPrt DestIP   DPrt State       Expires\n");
+			 "Pro FromIP   FPrt ToIP     TPrt DestIP   DPrt State       Expires\n");
 	else {
 		const struct ip_vs_conn *cp = v;
 
 		seq_printf(seq,
-			"%-3s %08X %04X %08X %04X %08X %04X %-11s %7lu\n",
-				ip_vs_proto_name(cp->protocol),
-				ntohl(cp->caddr), ntohs(cp->cport),
-				ntohl(cp->vaddr), ntohs(cp->vport),
-				ntohl(cp->daddr), ntohs(cp->dport),
-				ip_vs_state_name(cp->protocol, cp->state),
-				(cp->timer.expires-jiffies)/HZ);
+			   "%-3s %08X %04X %08X %04X %08X %04X %-11s %7lu\n",
+			   ip_vs_proto_name(cp->protocol),
+			   ntohl(cp->caddr), ntohs(cp->cport),
+			   ntohl(cp->vaddr), ntohs(cp->vport),
+			   ntohl(cp->daddr), ntohs(cp->dport),
+			   ip_vs_state_name(cp->protocol, cp->state),
+			   (cp->timer.expires-jiffies)/HZ);
 	}
 	return 0;
 }
@@ -888,7 +888,9 @@
 		__ip_vs_conntbl_lock_array[idx].l = RW_LOCK_UNLOCKED;
 	}
 
+#ifdef CONFIG_PROC_FS
 	proc_net_fops_create("ip_vs_conn", 0, &ip_vs_conn_fops);
+#endif
 
 	/* calculate the random value for connection hash */
 	get_random_bytes(&ip_vs_conn_rnd, sizeof(ip_vs_conn_rnd));
@@ -902,8 +904,10 @@
 	/* flush all the connection entries first */
 	ip_vs_conn_flush();
 
+#ifdef CONFIG_PROC_FS
+	proc_net_remove("ip_vs_conn");
+#endif
 	/* Release the empty cache */
 	kmem_cache_destroy(ip_vs_conn_cachep);
-	proc_net_remove("ip_vs_conn");
 	vfree(ip_vs_conn_tab);
 }
diff -Nru a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
--- a/net/ipv4/ipvs/ip_vs_ctl.c	Sat Oct  4 22:55:34 2003
+++ b/net/ipv4/ipvs/ip_vs_ctl.c	Sat Oct  4 22:55:34 2003
@@ -1276,7 +1276,7 @@
 	 * Flush the service table hashed by fwmark
 	 */
 	for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) {
-		list_for_each_entry_safe(svc, nxt, 
+		list_for_each_entry_safe(svc, nxt,
 					 &ip_vs_svc_fwm_table[idx], f_list) {
 			write_lock_bh(&__ip_vs_svc_lock);
 			ip_vs_svc_unhash(svc);
@@ -1535,7 +1535,6 @@
 
 static void *ip_vs_info_seq_start(struct seq_file *seq, loff_t *pos)
 {
-
 	read_lock_bh(&__ip_vs_svc_lock);
 	return *pos ? ip_vs_info_array(seq, *pos - 1) : SEQ_START_TOKEN;
 }
@@ -1550,16 +1549,15 @@
 	++*pos;
 	if (v == SEQ_START_TOKEN)
 		return ip_vs_info_array(seq,0);
-	
+
 	svc = v;
 	iter = seq->private;
-	
+
 	if (iter->table == ip_vs_svc_table) {
 		/* next service in table hashed by protocol */
 		if ((e = svc->s_list.next) != &ip_vs_svc_table[iter->bucket])
 			return list_entry(e, struct ip_vs_service, s_list);
 
-
 		while (++iter->bucket < IP_VS_SVC_TAB_SIZE) {
 			list_for_each_entry(svc,&ip_vs_svc_table[iter->bucket],
 					    s_list) {
@@ -1576,10 +1574,10 @@
 	if ((e = svc->f_list.next) != &ip_vs_svc_fwm_table[iter->bucket])
 		return list_entry(e, struct ip_vs_service, f_list);
 
- scan_fwmark:
+  scan_fwmark:
 	while (++iter->bucket < IP_VS_SVC_TAB_SIZE) {
 		list_for_each_entry(svc, &ip_vs_svc_fwm_table[iter->bucket],
-				    f_list) 
+				    f_list)
 			return svc;
 	}
 
@@ -1607,7 +1605,7 @@
 		const struct ip_vs_iter *iter = seq->private;
 		const struct ip_vs_dest *dest;
 
-		if (iter->table == ip_vs_svc_table) 
+		if (iter->table == ip_vs_svc_table)
 			seq_printf(seq, "%s  %08X:%04X %s ",
 				   ip_vs_proto_name(svc->protocol),
 				   ntohl(svc->addr),
@@ -1625,7 +1623,7 @@
 			seq_putc(seq, '\n');
 
 		list_for_each_entry(dest, &svc->destinations, n_list) {
-			seq_printf(seq, 
+			seq_printf(seq,
 				   "  -> %08X:%04X      %-7s %-6d %-10d %-10d\n",
 				   ntohl(dest->addr), ntohs(dest->port),
 				   ip_vs_fwd_name(atomic_read(&dest->conn_flags)),
@@ -1686,7 +1684,7 @@
 /*               01234567 01234567 01234567 0123456701234567 0123456701234567 */
 	seq_puts(seq,
 		 "   Total Incoming Outgoing         Incoming         Outgoing\n");
-	seq_printf(seq, 	   
+	seq_printf(seq,
 		   "   Conns  Packets  Packets            Bytes            Bytes\n");
 
 	spin_lock_bh(&ip_vs_stats.lock);
@@ -2205,8 +2203,10 @@
 		return ret;
 	}
 
+#ifdef CONFIG_PROC_FS
 	proc_net_fops_create("ip_vs", 0, &ip_vs_info_fops);
 	proc_net_fops_create("ip_vs_stats",0, &ip_vs_stats_fops);
+#endif
 
 	ipv4_vs_table.sysctl_header =
 		register_sysctl_table(ipv4_vs_table.root_dir, 0);
@@ -2242,8 +2242,10 @@
 	del_timer_sync(&defense_timer);
 	ip_vs_kill_estimator(&ip_vs_stats);
 	unregister_sysctl_table(ipv4_vs_table.sysctl_header);
+#ifdef CONFIG_PROC_FS
 	proc_net_remove("ip_vs_stats");
 	proc_net_remove("ip_vs");
+#endif
 	nf_unregister_sockopt(&ip_vs_sockopts);
 	LeaveFunction(2);
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-10-06 11:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-05 12:41 [2.6 PATCH] ipvs - two additional minor patches Wensong Zhang
2003-10-05 14:39 ` David S. Miller
2003-10-05 14:50 ` David S. Miller
2003-10-06 11:54   ` Wensong Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).