diff options
author | Patrick Schaaf <netdev@bof.de> | 2011-02-11 08:01:12 -0500 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2011-02-16 00:53:33 -0500 |
commit | 41ac51eeda58a85b8a06d748cce7035cc77deebd (patch) | |
tree | d647f55796e3b7cb0d5a9f86429ce89877afacec | |
parent | 6cb90db502c5f276c8d6256762cc3acde4d3bd9d (diff) |
ipvs: make "no destination available" message more informative
When IP_VS schedulers do not find a destination, they output a terse
"WLC: no destination available" message through kernel syslog, which I
can not only make sense of because syslog puts them in a logfile
together with keepalived checker results.
This patch makes the output a bit more informative, by telling you which
virtual service failed to find a destination.
Example output:
kernel: [1539214.552233] IPVS: wlc: TCP 192.168.8.30:22 - no destination available
kernel: [1539299.674418] IPVS: wlc: FWM 22 0x00000016 - no destination available
I have tested the code for IPv4 and FWM services, as you can see from
the example; I do not have an IPv6 setup to test the third code path
with.
To avoid code duplication, I put a new function ip_vs_scheduler_err()
into ip_vs_sched.c, and use that from the schedulers instead of calling
IP_VS_ERR_RL directly.
Signed-off-by: Patrick Schaaf <netdev@bof.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r-- | include/net/ip_vs.h | 2 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_lblc.c | 2 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_lblcr.c | 2 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_lc.c | 2 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_nq.c | 2 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_rr.c | 2 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_sched.c | 25 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_sed.c | 2 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_sh.c | 2 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_wlc.c | 2 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_wrr.c | 14 |
11 files changed, 43 insertions, 14 deletions
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 5d75feadf4f4..93995494dfd4 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -1019,6 +1019,8 @@ ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, | |||
1019 | extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, | 1019 | extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, |
1020 | struct ip_vs_proto_data *pd); | 1020 | struct ip_vs_proto_data *pd); |
1021 | 1021 | ||
1022 | extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); | ||
1023 | |||
1022 | 1024 | ||
1023 | /* | 1025 | /* |
1024 | * IPVS control data and functions (from ip_vs_ctl.c) | 1026 | * IPVS control data and functions (from ip_vs_ctl.c) |
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c index 00b5ffab3768..4a9c8cd19690 100644 --- a/net/netfilter/ipvs/ip_vs_lblc.c +++ b/net/netfilter/ipvs/ip_vs_lblc.c | |||
@@ -510,7 +510,7 @@ ip_vs_lblc_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
510 | /* No cache entry or it is invalid, time to schedule */ | 510 | /* No cache entry or it is invalid, time to schedule */ |
511 | dest = __ip_vs_lblc_schedule(svc); | 511 | dest = __ip_vs_lblc_schedule(svc); |
512 | if (!dest) { | 512 | if (!dest) { |
513 | IP_VS_ERR_RL("LBLC: no destination available\n"); | 513 | ip_vs_scheduler_err(svc, "no destination available"); |
514 | return NULL; | 514 | return NULL; |
515 | } | 515 | } |
516 | 516 | ||
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c index bfa25f1ea9e4..bd329b1e9589 100644 --- a/net/netfilter/ipvs/ip_vs_lblcr.c +++ b/net/netfilter/ipvs/ip_vs_lblcr.c | |||
@@ -692,7 +692,7 @@ ip_vs_lblcr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
692 | /* The cache entry is invalid, time to schedule */ | 692 | /* The cache entry is invalid, time to schedule */ |
693 | dest = __ip_vs_lblcr_schedule(svc); | 693 | dest = __ip_vs_lblcr_schedule(svc); |
694 | if (!dest) { | 694 | if (!dest) { |
695 | IP_VS_ERR_RL("LBLCR: no destination available\n"); | 695 | ip_vs_scheduler_err(svc, "no destination available"); |
696 | read_unlock(&svc->sched_lock); | 696 | read_unlock(&svc->sched_lock); |
697 | return NULL; | 697 | return NULL; |
698 | } | 698 | } |
diff --git a/net/netfilter/ipvs/ip_vs_lc.c b/net/netfilter/ipvs/ip_vs_lc.c index 4f69db1fac56..60638007c6c7 100644 --- a/net/netfilter/ipvs/ip_vs_lc.c +++ b/net/netfilter/ipvs/ip_vs_lc.c | |||
@@ -70,7 +70,7 @@ ip_vs_lc_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | if (!least) | 72 | if (!least) |
73 | IP_VS_ERR_RL("LC: no destination available\n"); | 73 | ip_vs_scheduler_err(svc, "no destination available"); |
74 | else | 74 | else |
75 | IP_VS_DBG_BUF(6, "LC: server %s:%u activeconns %d " | 75 | IP_VS_DBG_BUF(6, "LC: server %s:%u activeconns %d " |
76 | "inactconns %d\n", | 76 | "inactconns %d\n", |
diff --git a/net/netfilter/ipvs/ip_vs_nq.c b/net/netfilter/ipvs/ip_vs_nq.c index c413e1830823..984d9c137d84 100644 --- a/net/netfilter/ipvs/ip_vs_nq.c +++ b/net/netfilter/ipvs/ip_vs_nq.c | |||
@@ -99,7 +99,7 @@ ip_vs_nq_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
99 | } | 99 | } |
100 | 100 | ||
101 | if (!least) { | 101 | if (!least) { |
102 | IP_VS_ERR_RL("NQ: no destination available\n"); | 102 | ip_vs_scheduler_err(svc, "no destination available"); |
103 | return NULL; | 103 | return NULL; |
104 | } | 104 | } |
105 | 105 | ||
diff --git a/net/netfilter/ipvs/ip_vs_rr.c b/net/netfilter/ipvs/ip_vs_rr.c index e210f37d8ea2..c49b388d1085 100644 --- a/net/netfilter/ipvs/ip_vs_rr.c +++ b/net/netfilter/ipvs/ip_vs_rr.c | |||
@@ -72,7 +72,7 @@ ip_vs_rr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
72 | q = q->next; | 72 | q = q->next; |
73 | } while (q != p); | 73 | } while (q != p); |
74 | write_unlock(&svc->sched_lock); | 74 | write_unlock(&svc->sched_lock); |
75 | IP_VS_ERR_RL("RR: no destination available\n"); | 75 | ip_vs_scheduler_err(svc, "no destination available"); |
76 | return NULL; | 76 | return NULL; |
77 | 77 | ||
78 | out: | 78 | out: |
diff --git a/net/netfilter/ipvs/ip_vs_sched.c b/net/netfilter/ipvs/ip_vs_sched.c index 076ebe00435d..08dbdd5bc18f 100644 --- a/net/netfilter/ipvs/ip_vs_sched.c +++ b/net/netfilter/ipvs/ip_vs_sched.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include <net/ip_vs.h> | 30 | #include <net/ip_vs.h> |
31 | 31 | ||
32 | EXPORT_SYMBOL(ip_vs_scheduler_err); | ||
32 | /* | 33 | /* |
33 | * IPVS scheduler list | 34 | * IPVS scheduler list |
34 | */ | 35 | */ |
@@ -146,6 +147,30 @@ void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler) | |||
146 | module_put(scheduler->module); | 147 | module_put(scheduler->module); |
147 | } | 148 | } |
148 | 149 | ||
150 | /* | ||
151 | * Common error output helper for schedulers | ||
152 | */ | ||
153 | |||
154 | void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg) | ||
155 | { | ||
156 | if (svc->fwmark) { | ||
157 | IP_VS_ERR_RL("%s: FWM %u 0x%08X - %s\n", | ||
158 | svc->scheduler->name, svc->fwmark, | ||
159 | svc->fwmark, msg); | ||
160 | #ifdef CONFIG_IP_VS_IPV6 | ||
161 | } else if (svc->af == AF_INET6) { | ||
162 | IP_VS_ERR_RL("%s: %s [%pI6]:%d - %s\n", | ||
163 | svc->scheduler->name, | ||
164 | ip_vs_proto_name(svc->protocol), | ||
165 | &svc->addr.in6, ntohs(svc->port), msg); | ||
166 | #endif | ||
167 | } else { | ||
168 | IP_VS_ERR_RL("%s: %s %pI4:%d - %s\n", | ||
169 | svc->scheduler->name, | ||
170 | ip_vs_proto_name(svc->protocol), | ||
171 | &svc->addr.ip, ntohs(svc->port), msg); | ||
172 | } | ||
173 | } | ||
149 | 174 | ||
150 | /* | 175 | /* |
151 | * Register a scheduler in the scheduler list | 176 | * Register a scheduler in the scheduler list |
diff --git a/net/netfilter/ipvs/ip_vs_sed.c b/net/netfilter/ipvs/ip_vs_sed.c index 1ab75a9dc400..89ead246ed3d 100644 --- a/net/netfilter/ipvs/ip_vs_sed.c +++ b/net/netfilter/ipvs/ip_vs_sed.c | |||
@@ -87,7 +87,7 @@ ip_vs_sed_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
87 | goto nextstage; | 87 | goto nextstage; |
88 | } | 88 | } |
89 | } | 89 | } |
90 | IP_VS_ERR_RL("SED: no destination available\n"); | 90 | ip_vs_scheduler_err(svc, "no destination available"); |
91 | return NULL; | 91 | return NULL; |
92 | 92 | ||
93 | /* | 93 | /* |
diff --git a/net/netfilter/ipvs/ip_vs_sh.c b/net/netfilter/ipvs/ip_vs_sh.c index e6cc174fbc06..b5e2556c581a 100644 --- a/net/netfilter/ipvs/ip_vs_sh.c +++ b/net/netfilter/ipvs/ip_vs_sh.c | |||
@@ -223,7 +223,7 @@ ip_vs_sh_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
223 | || !(dest->flags & IP_VS_DEST_F_AVAILABLE) | 223 | || !(dest->flags & IP_VS_DEST_F_AVAILABLE) |
224 | || atomic_read(&dest->weight) <= 0 | 224 | || atomic_read(&dest->weight) <= 0 |
225 | || is_overloaded(dest)) { | 225 | || is_overloaded(dest)) { |
226 | IP_VS_ERR_RL("SH: no destination available\n"); | 226 | ip_vs_scheduler_err(svc, "no destination available"); |
227 | return NULL; | 227 | return NULL; |
228 | } | 228 | } |
229 | 229 | ||
diff --git a/net/netfilter/ipvs/ip_vs_wlc.c b/net/netfilter/ipvs/ip_vs_wlc.c index bbddfdb10db2..fdf0f58962a4 100644 --- a/net/netfilter/ipvs/ip_vs_wlc.c +++ b/net/netfilter/ipvs/ip_vs_wlc.c | |||
@@ -75,7 +75,7 @@ ip_vs_wlc_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
75 | goto nextstage; | 75 | goto nextstage; |
76 | } | 76 | } |
77 | } | 77 | } |
78 | IP_VS_ERR_RL("WLC: no destination available\n"); | 78 | ip_vs_scheduler_err(svc, "no destination available"); |
79 | return NULL; | 79 | return NULL; |
80 | 80 | ||
81 | /* | 81 | /* |
diff --git a/net/netfilter/ipvs/ip_vs_wrr.c b/net/netfilter/ipvs/ip_vs_wrr.c index 30db633f88f1..1ef41f50723c 100644 --- a/net/netfilter/ipvs/ip_vs_wrr.c +++ b/net/netfilter/ipvs/ip_vs_wrr.c | |||
@@ -147,8 +147,9 @@ ip_vs_wrr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
147 | 147 | ||
148 | if (mark->cl == mark->cl->next) { | 148 | if (mark->cl == mark->cl->next) { |
149 | /* no dest entry */ | 149 | /* no dest entry */ |
150 | IP_VS_ERR_RL("WRR: no destination available: " | 150 | ip_vs_scheduler_err(svc, |
151 | "no destinations present\n"); | 151 | "no destination available: " |
152 | "no destinations present"); | ||
152 | dest = NULL; | 153 | dest = NULL; |
153 | goto out; | 154 | goto out; |
154 | } | 155 | } |
@@ -162,8 +163,8 @@ ip_vs_wrr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
162 | */ | 163 | */ |
163 | if (mark->cw == 0) { | 164 | if (mark->cw == 0) { |
164 | mark->cl = &svc->destinations; | 165 | mark->cl = &svc->destinations; |
165 | IP_VS_ERR_RL("WRR: no destination " | 166 | ip_vs_scheduler_err(svc, |
166 | "available\n"); | 167 | "no destination available"); |
167 | dest = NULL; | 168 | dest = NULL; |
168 | goto out; | 169 | goto out; |
169 | } | 170 | } |
@@ -185,8 +186,9 @@ ip_vs_wrr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb) | |||
185 | /* back to the start, and no dest is found. | 186 | /* back to the start, and no dest is found. |
186 | It is only possible when all dests are OVERLOADED */ | 187 | It is only possible when all dests are OVERLOADED */ |
187 | dest = NULL; | 188 | dest = NULL; |
188 | IP_VS_ERR_RL("WRR: no destination available: " | 189 | ip_vs_scheduler_err(svc, |
189 | "all destinations are overloaded\n"); | 190 | "no destination available: " |
191 | "all destinations are overloaded"); | ||
190 | goto out; | 192 | goto out; |
191 | } | 193 | } |
192 | } | 194 | } |