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 .
- [Patch net-next v2] mlx5: use RCU lock in mlx5_eq_cq_get() Cong Wang
- Re: [Patch net-next v2] mlx5: use RCU lock in mlx5_eq_... Eric Dumazet
- Re: [Patch net-next v2] mlx5: use RCU lock in mlx5... Eric Dumazet
- Re: [Patch net-next v2] mlx5: use RCU lock in mlx5... Cong Wang
- Re: [Patch net-next v2] mlx5: use RCU lock in ... Eric Dumazet
- Re: [Patch net-next v2] mlx5: use RCU lock... Saeed Mahameed
- Re: [Patch net-next v2] mlx5: use RCU lock... Cong Wang
- Re: [Patch net-next v2] mlx5: use RCU... Saeed Mahameed
- Re: [Patch net-next v2] mlx5: use RCU lock in mlx5_eq_... Saeed Mahameed