patch-2.4.26 linux-2.4.26/net/ipv4/ipvs/ip_vs_ctl.c

Next file: linux-2.4.26/net/ipv4/ipvs/ip_vs_dh.c
Previous file: linux-2.4.26/net/ipv4/ipvs/ip_vs_conn.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.25/net/ipv4/ipvs/ip_vs_ctl.c linux-2.4.26/net/ipv4/ipvs/ip_vs_ctl.c
@@ -20,12 +20,9 @@
  *
  */
 
-#include <linux/config.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/types.h>
-#include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/sysctl.h>
 #include <linux/proc_fs.h>
@@ -892,9 +889,16 @@
 
 	__ip_vs_update_dest(svc, dest, ur);
 
+	write_lock_bh(&__ip_vs_svc_lock);
+
+	/* Wait until all other svc users go away */
+	while (atomic_read(&svc->usecnt) > 1) {};
+
 	/* call the update_service, because server weight may be changed */
 	svc->scheduler->update_service(svc);
 
+	write_unlock_bh(&__ip_vs_svc_lock);
+
 	LeaveFunction(2);
 
 	return 0;
@@ -1694,7 +1698,7 @@
 	 * len > 128000 is a sanity check.
 	 */
 	if (len < sizeof(struct ip_vs_rule_user)) {
-		IP_VS_ERR("set_ctl: len %u < %u\n",
+		IP_VS_ERR("set_ctl: len %u < %Zu\n",
 			  len, sizeof(struct ip_vs_rule_user));
 		return -EINVAL;
 	} else if (len > 128000) {
@@ -1740,9 +1744,9 @@
 	 * Check for valid protocol: TCP or UDP. Even for fwmark!=0
 	 */
 	if (urule->protocol!=IPPROTO_TCP && urule->protocol!=IPPROTO_UDP) {
-		IP_VS_INFO("vs_ctl: invalid protocol: %d %d.%d.%d.%d:%d %s",
-			   ntohs(urule->protocol), NIPQUAD(urule->vaddr),
-			   ntohs(urule->vport), urule->sched_name);
+		IP_VS_ERR("set_ctl: invalid protocol %d %d.%d.%d.%d:%d %s\n",
+			  urule->protocol, NIPQUAD(urule->vaddr),
+			  ntohs(urule->vport), urule->sched_name);
 		ret = -EFAULT;
 		goto out_unlock;
 	}
@@ -1972,7 +1976,7 @@
 		struct ip_vs_get_services get;
 
 		if (*len < sizeof(get)) {
-			IP_VS_ERR("length: %u < %u\n", *len, sizeof(get));
+			IP_VS_ERR("length: %u < %Zu\n", *len, sizeof(get));
 			ret = -EINVAL;
 			goto out;
 		}
@@ -1981,7 +1985,7 @@
 			goto out;
 		}
 		if (*len != (sizeof(get)+sizeof(struct ip_vs_service_user)*get.num_services)) {
-			IP_VS_ERR("length: %u != %u\n", *len,
+			IP_VS_ERR("length: %u != %Zu\n", *len,
 				  sizeof(get)+sizeof(struct ip_vs_service_user)*get.num_services);
 			ret = -EINVAL;
 			goto out;
@@ -1996,7 +2000,7 @@
 		struct ip_vs_service *svc;
 
 		if (*len != sizeof(get)) {
-			IP_VS_ERR("length: %u != %u\n", *len, sizeof(get));
+			IP_VS_ERR("length: %u != %Zu\n", *len, sizeof(get));
 			ret = -EINVAL;
 			goto out;
 		}
@@ -2030,7 +2034,7 @@
 		struct ip_vs_get_dests get;
 
 		if (*len < sizeof(get)) {
-			IP_VS_ERR("length: %u < %u\n", *len, sizeof(get));
+			IP_VS_ERR("length: %u < %Zu\n", *len, sizeof(get));
 			ret = -EINVAL;
 			goto out;
 		}
@@ -2040,7 +2044,7 @@
 		}
 		if (*len != (sizeof(get) +
 			     sizeof(struct ip_vs_dest_user)*get.num_dests)) {
-			IP_VS_ERR("length: %u != %u\n", *len,
+			IP_VS_ERR("length: %u != %Zu\n", *len,
 				  sizeof(get)+sizeof(struct ip_vs_dest_user)*get.num_dests);
 			ret = -EINVAL;
 			goto out;
@@ -2054,7 +2058,7 @@
 		struct ip_vs_timeout_user u;
 
 		if (*len < sizeof(u)) {
-			IP_VS_ERR("length: %u < %u\n", *len, sizeof(u));
+			IP_VS_ERR("length: %u < %Zu\n", *len, sizeof(u));
 			ret = -EINVAL;
 			goto out;
 		}
@@ -2069,7 +2073,7 @@
 		struct ip_vs_daemon_user u;
 
 		if (*len < sizeof(u)) {
-			IP_VS_ERR("length: %u < %u\n", *len, sizeof(u));
+			IP_VS_ERR("length: %u < %Zu\n", *len, sizeof(u));
 			ret = -EINVAL;
 			goto out;
 		}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)