{
struct ip_vs_service *svc = rcu_dereference_protected(dest->svc, 1);
- __ip_vs_dst_cache_reset(dest);
__ip_vs_svc_put(svc);
call_rcu(&dest->rcu_head, ip_vs_dest_rcu_free);
}
dest->af = udest->af;
- spin_lock_bh(&dest->dst_lock);
- __ip_vs_dst_cache_reset(dest);
- spin_unlock_bh(&dest->dst_lock);
-
if (add) {
list_add_rcu(&dest->n_list, &svc->destinations);
svc->num_dests++;
if (sched && sched->add_dest)
sched->add_dest(svc, dest);
} else {
+ spin_lock_bh(&dest->dst_lock);
+ __ip_vs_dst_cache_reset(dest);
+ spin_unlock_bh(&dest->dst_lock);
+
sched = rcu_dereference_protected(svc->scheduler, 1);
if (sched && sched->upd_dest)
sched->upd_dest(svc, dest);
{
dest->flags &= ~IP_VS_DEST_F_AVAILABLE;
+ spin_lock_bh(&dest->dst_lock);
+ __ip_vs_dst_cache_reset(dest);
+ spin_unlock_bh(&dest->dst_lock);
+
/*
* Remove it from the d-linked destination list.
*/
}
rcu_read_unlock();
- mutex_lock(&ipvs->service_mutex);
- spin_lock_bh(&ipvs->dest_trash_lock);
- list_for_each_entry(dest, &ipvs->dest_trash, t_list) {
- ip_vs_forget_dev(dest, dev);
- }
- spin_unlock_bh(&ipvs->dest_trash_lock);
- mutex_unlock(&ipvs->service_mutex);
return NOTIFY_DONE;
}
goto err_unreach;
}
/* It is forbidden to attach dest->dest_dst if
- * device is going down.
+ * device is going down or if server is removed and
+ * stored in dest_trash.
*/
- if (!rt_dev_is_down(dst_dev_rcu(&rt->dst)))
+ if (!rt_dev_is_down(dst_dev_rcu(&rt->dst)) &&
+ dest->flags & IP_VS_DEST_F_AVAILABLE)
__ip_vs_dst_set(dest, dest_dst, &rt->dst, 0);
else
noref = 0;
rt = dst_rt6_info(dst);
cookie = rt6_get_cookie(rt);
/* It is forbidden to attach dest->dest_dst if
- * device is going down.
+ * device is going down or if server is removed and
+ * stored in dest_trash.
*/
- if (!rt_dev_is_down(dst_dev_rcu(&rt->dst)))
+ if (!rt_dev_is_down(dst_dev_rcu(&rt->dst)) &&
+ dest->flags & IP_VS_DEST_F_AVAILABLE)
__ip_vs_dst_set(dest, dest_dst, &rt->dst, cookie);
else
noref = 0;