[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170530162020.137aef02@xeon-e3>
Date: Tue, 30 May 2017 16:20:20 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Sowmini Varadhan <sowmini.varadhan@...cle.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH RFC net-next] arp: Really delete an arp entry on "arp
-d"
On Mon, 29 May 2017 20:48:16 -0700
Sowmini Varadhan <sowmini.varadhan@...cle.com> 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.
Powered by blists - more mailing lists