On Mon, 3 Oct 2016, HePeng wrote:
> Hello Julian,
> Thank you very much for the reply.
> I guess this is the same reason that
> instead of using *__ip_vs_conn_get*,
> you use *atomic_inc* to the ref of
> *cp* in *ip_vs_conn_expire* when fails to unlink *cp*,
> since there is no callback is running on other CPUs, the
> ref must be large than 0. That is also
> one of my questions when I read the code.
Yes, ip_vs_conn_unlink() can see refcnt=2 or more
in which case it does not change refcnt (1->0) and conn remains
hashed. But we have to start the timer again, so the pair
atomic_inc+__ip_vs_conn_put_timer is used. It looks safe
to call __ip_vs_conn_get, atomic_inc_not_zero will work
in this case because while in timer callback refcnt can not
go below 1, even if other CPUs call ip_vs_conn_unhash+
ip_vs_conn_hash. But atomic_inc is better.
Julian Anastasov <ja@xxxxxx>