From: David Miller <davem@davemloft.net>
To: dhowells@redhat.com
Cc: netdev@vger.kernel.org, marc.dionne@auristor.com,
linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] rxrpc: Fix lack of conn cleanup when local endpoint is cleaned up
Date: Sat, 24 Aug 2019 14:35:33 -0700 (PDT) [thread overview]
Message-ID: <20190824.143533.1547411490171696760.davem@davemloft.net> (raw)
In-Reply-To: <156647679816.11606.13713532963081370001.stgit@warthog.procyon.org.uk>
From: David Howells <dhowells@redhat.com>
Date: Thu, 22 Aug 2019 13:26:38 +0100
> + spin_lock(&rxnet->client_conn_cache_lock);
> + nr_active = rxnet->nr_active_client_conns;
> +
> + list_for_each_entry_safe(conn, tmp, &rxnet->idle_client_conns,
> + cache_link) {
> + if (conn->params.local == local) {
> + ASSERTCMP(conn->cache_state, ==, RXRPC_CONN_CLIENT_IDLE);
> +
> + trace_rxrpc_client(conn, -1, rxrpc_client_discard);
> + if (!test_and_clear_bit(RXRPC_CONN_EXPOSED, &conn->flags))
> + BUG();
> + conn->cache_state = RXRPC_CONN_CLIENT_INACTIVE;
> + list_move(&conn->cache_link, &graveyard);
> + nr_active--;
> + }
> + }
> +
> + rxnet->nr_active_client_conns = nr_active;
> + spin_unlock(&rxnet->client_conn_cache_lock);
> + ASSERTCMP(nr_active, >=, 0);
> +
> + spin_lock(&rxnet->client_conn_cache_lock);
> + while (!list_empty(&graveyard)) {
> + conn = list_entry(graveyard.next,
> + struct rxrpc_connection, cache_link);
> + list_del_init(&conn->cache_link);
> + spin_unlock(&rxnet->client_conn_cache_lock);
> +
> + rxrpc_put_connection(conn);
> +
> + spin_lock(&rxnet->client_conn_cache_lock);
> + }
> + spin_unlock(&rxnet->client_conn_cache_lock);
> +
> + _leave(" [culled]");
Once you've removed the entries from the globally visible idle_client_comms
list, and put them on the local garbage list, they cannot be seen in any way
by external threads of control outside of this function.
Therefore, you don't need to take the client_conn_cache_lock at all in the
second while loop.
next prev parent reply other threads:[~2019-08-24 21:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-22 12:26 David Howells
2019-08-24 21:35 ` David Miller [this message]
2019-08-27 12:57 ` David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190824.143533.1547411490171696760.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®