linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: davem@davemloft.net
Cc: dhowells@redhat.com, netdev@vger.kernel.org,
	linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next 07/14] rxrpc: rxrpc_connection_lock shouldn't be a BH lock, but conn_lock is
Date: Wed, 22 Jun 2016 10:50:32 +0100	[thread overview]
Message-ID: <146658903293.4550.1641939532002392976.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <146658898230.4550.7226255613607733759.stgit@warthog.procyon.org.uk>

rxrpc_connection_lock shouldn't be accessed as a BH-excluding lock.  It's
only accessed in a few places and none of those are in BH-context.

rxrpc_transport::conn_lock, however, *is* a BH-excluding lock and should be
accessed so consistently.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 net/rxrpc/conn_object.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/rxrpc/conn_object.c b/net/rxrpc/conn_object.c
index 3b42fc4f4fe3..cab2f6dbc5a1 100644
--- a/net/rxrpc/conn_object.c
+++ b/net/rxrpc/conn_object.c
@@ -356,9 +356,9 @@ static int rxrpc_connect_exclusive(struct rxrpc_sock *rx,
 		return ret;
 	}
 
-	write_lock_bh(&rxrpc_connection_lock);
+	write_lock(&rxrpc_connection_lock);
 	list_add_tail(&conn->link, &rxrpc_connections);
-	write_unlock_bh(&rxrpc_connection_lock);
+	write_unlock(&rxrpc_connection_lock);
 
 	spin_lock(&trans->client_lock);
 	atomic_inc(&trans->usage);
@@ -677,9 +677,9 @@ rxrpc_incoming_connection(struct rxrpc_transport *trans, struct sk_buff *skb)
 
 	write_unlock_bh(&trans->conn_lock);
 
-	write_lock_bh(&rxrpc_connection_lock);
+	write_lock(&rxrpc_connection_lock);
 	list_add_tail(&conn->link, &rxrpc_connections);
-	write_unlock_bh(&rxrpc_connection_lock);
+	write_unlock(&rxrpc_connection_lock);
 
 	new = "new";
 
@@ -828,7 +828,7 @@ static void rxrpc_connection_reaper(struct work_struct *work)
 	now = ktime_get_seconds();
 	earliest = ULONG_MAX;
 
-	write_lock_bh(&rxrpc_connection_lock);
+	write_lock(&rxrpc_connection_lock);
 	list_for_each_entry_safe(conn, _p, &rxrpc_connections, link) {
 		_debug("reap CONN %d { u=%d,t=%ld }",
 		       conn->debug_id, atomic_read(&conn->usage),
@@ -838,7 +838,7 @@ static void rxrpc_connection_reaper(struct work_struct *work)
 			continue;
 
 		spin_lock(&conn->trans->client_lock);
-		write_lock(&conn->trans->conn_lock);
+		write_lock_bh(&conn->trans->conn_lock);
 		reap_time = conn->put_time + rxrpc_connection_expiry;
 
 		if (atomic_read(&conn->usage) > 0) {
@@ -860,10 +860,10 @@ static void rxrpc_connection_reaper(struct work_struct *work)
 			earliest = reap_time;
 		}
 
-		write_unlock(&conn->trans->conn_lock);
+		write_unlock_bh(&conn->trans->conn_lock);
 		spin_unlock(&conn->trans->client_lock);
 	}
-	write_unlock_bh(&rxrpc_connection_lock);
+	write_unlock(&rxrpc_connection_lock);
 
 	if (earliest != ULONG_MAX) {
 		_debug("reschedule reaper %ld", (long) earliest - now);

  parent reply	other threads:[~2016-06-22  9:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22  9:49 [PATCH net-next 00/14] rxrpc: Get rid of conn bundle and transport structs David Howells
2016-06-22  9:49 ` [PATCH net-next 01/14] rxrpc: checking for IS_ERR() instead of NULL David Howells
2016-06-22  9:49 ` [PATCH net-next 02/14] rxrpc: fix uninitialized variable use David Howells
2016-06-22  9:50 ` [PATCH net-next 03/14] rxrpc: Use structs to hold connection params and protocol info David Howells
2016-06-22  9:50 ` [PATCH net-next 04/14] rxrpc: Replace conn->trans->{local, peer} with conn->params.{local, peer} David Howells
2016-06-22  9:50 ` [PATCH net-next 05/14] rxrpc: Fix exclusive connection handling David Howells
2016-06-22  9:50 ` [PATCH net-next 06/14] rxrpc: Pass sk_buff * rather than rxrpc_host_header * to functions David Howells
2016-06-22  9:50 ` David Howells [this message]
2016-06-22  9:50 ` [PATCH net-next 08/14] rxrpc: Use IDR to allocate client conn IDs on a machine-wide basis David Howells
2016-06-22  9:50 ` [PATCH net-next 09/14] rxrpc: Validate the net address given to rxrpc_kernel_begin_call() David Howells
2016-06-22  9:50 ` [PATCH net-next 10/14] rxrpc: Calls displayed in /proc may in future lack a connection David Howells
2016-06-22  9:51 ` [PATCH net-next 11/14] rxrpc: Make rxrpc_send_packet() take a connection not a transport David Howells
2016-06-22  9:51 ` [PATCH net-next 12/14] rxrpc: Provide more refcount helper functions David Howells
2016-06-22  9:51 ` [PATCH net-next 13/14] rxrpc: Kill the client connection bundle concept David Howells
2016-06-22  9:51 ` [PATCH net-next 14/14] rxrpc: Kill off the rxrpc_transport struct David Howells
2016-06-22 10:03 ` [PATCH net-next 00/14] rxrpc: Get rid of conn bundle and transport structs 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=146658903293.4550.1641939532002392976.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=davem@davemloft.net \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).