int (*done_service)(struct ip_vs_service *svc);
/* scheduler updating service */
int (*update_service)(struct ip_vs_service *svc);
+ /* dest is linked */
+ int (*add_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest);
+ /* dest is unlinked */
+ int (*del_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest);
+ /* dest is updated */
+ int (*upd_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest);
/* selecting a server from the given service */
struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc,
* template is not available.
* return *ignored=0 i.e. ICMP and NF_DROP
*/
+ rcu_read_lock();
dest = svc->scheduler->schedule(svc, skb);
if (!dest) {
+ rcu_read_unlock();
IP_VS_DBG(1, "p-schedule: no dest found.\n");
kfree(param.pe_data);
*ignored = 0;
* when the template expires */
ct = ip_vs_conn_new(¶m, &dest->addr, dport,
IP_VS_CONN_F_TEMPLATE, dest, skb->mark);
+ rcu_read_unlock();
if (ct == NULL) {
kfree(param.pe_data);
*ignored = -1;
return NULL;
}
+ rcu_read_lock();
dest = svc->scheduler->schedule(svc, skb);
if (dest == NULL) {
+ rcu_read_unlock();
IP_VS_DBG(1, "Schedule: no dest found.\n");
return NULL;
}
cp = ip_vs_conn_new(&p, &dest->addr,
dest->port ? dest->port : pptr[1],
flags, dest, skb->mark);
+ rcu_read_unlock();
if (!cp) {
*ignored = -1;
return NULL;
if (add) {
list_add(&dest->n_list, &svc->destinations);
svc->num_dests++;
+ if (svc->scheduler->add_dest)
+ svc->scheduler->add_dest(svc, dest);
+ } else {
+ if (svc->scheduler->upd_dest)
+ svc->scheduler->upd_dest(svc, dest);
}
/* call the update_service, because server weight may be changed */
list_del(&dest->n_list);
svc->num_dests--;
+ if (svcupd && svc->scheduler->del_dest)
+ svc->scheduler->del_dest(svc, dest);
+
/*
* Call the update_service function of its scheduler
*/