On Mon, 29 May 2017 20:48:16 -0700
Sowmini Varadhan <[email protected]> wrote:
> + np = &nht->hash_buckets[hash_val];
> + while ((n = rcu_dereference_protected(*np,
> + lockdep_is_held(&tbl->lock))) != NULL) {
> + write_lock(&n->lock);
> + if (n == ndel) {
> + bool retval = false;
> +
> + if (atomic_read(&n->refcnt) == 1) {
> + rcu_assign_pointer(*np,
> + rcu_dereference_protected(n->next,
> + lockdep_is_held(&tbl->lock)));
> + n->dead = 1;
> + retval = true;
> + }
> + write_unlock(&n->lock);
> + if (retval)
> + neigh_cleanup_and_release(n);
> + write_unlock_bh(&tbl->lock);
> + return retval;
> + }
> + write_unlock(&n->lock);
> + np = &n->next;
> + }
> +
Please don't copy/paste chunks of code. Instead refactor and make this
into a helper function.