On 02/06/2019 03:36 PM, Eric Dumazet wrote:
> 

> I suspect that you need a variant that makes sure refcount is not zero.
> 
> ( Typical RCU rules apply )
> 
> if (cq && !refcount_inc_not_zero(&cq->refcount))
>       cq = NULL;
> 
> 
> See commit 6fa19f5637a6c22bc0999596bcc83bdcac8a4fa6 rds: fix refcount bug in 
> rds_sock_addref
> for a similar issue I fixed recently.
> 
 
By the way, we also could avoid two atomics on the cq->refcount , by using 
rcu_read_lock()/unlock()
in the two callers .


Reply via email to