linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: netdev@vger.kernel.org
Cc: dhowells@redhat.com, pabeni@redhat.com, eric.dumazet@gmail.com,
	linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH net 06/10] rxrpc: Carry call state out of locked section in rxrpc_rotate_tx_window()
Date: Mon, 08 Oct 2018 23:48:03 +0100	[thread overview]
Message-ID: <153903888348.17944.12633118494706316191.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <153903883882.17944.17642727588248415623.stgit@warthog.procyon.org.uk>

Carry the call state out of the locked section in rxrpc_rotate_tx_window()
rather than sampling it afterwards.  This is only used to select tracepoint
data, but could have changed by the time we do the tracepoint.

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

 net/rxrpc/input.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 8834aa627371..af8ce64f4162 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -278,23 +278,26 @@ static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
 static bool rxrpc_end_tx_phase(struct rxrpc_call *call, bool reply_begun,
 			       const char *abort_why)
 {
+	unsigned int state;
 
 	ASSERT(test_bit(RXRPC_CALL_TX_LAST, &call->flags));
 
 	write_lock(&call->state_lock);
 
-	switch (call->state) {
+	state = call->state;
+	switch (state) {
 	case RXRPC_CALL_CLIENT_SEND_REQUEST:
 	case RXRPC_CALL_CLIENT_AWAIT_REPLY:
 		if (reply_begun)
-			call->state = RXRPC_CALL_CLIENT_RECV_REPLY;
+			call->state = state = RXRPC_CALL_CLIENT_RECV_REPLY;
 		else
-			call->state = RXRPC_CALL_CLIENT_AWAIT_REPLY;
+			call->state = state = RXRPC_CALL_CLIENT_AWAIT_REPLY;
 		break;
 
 	case RXRPC_CALL_SERVER_AWAIT_ACK:
 		__rxrpc_call_completed(call);
 		rxrpc_notify_socket(call);
+		state = call->state;
 		break;
 
 	default:
@@ -302,11 +305,10 @@ static bool rxrpc_end_tx_phase(struct rxrpc_call *call, bool reply_begun,
 	}
 
 	write_unlock(&call->state_lock);
-	if (call->state == RXRPC_CALL_CLIENT_AWAIT_REPLY) {
+	if (state == RXRPC_CALL_CLIENT_AWAIT_REPLY)
 		trace_rxrpc_transmit(call, rxrpc_transmit_await_reply);
-	} else {
+	else
 		trace_rxrpc_transmit(call, rxrpc_transmit_end);
-	}
 	_leave(" = ok");
 	return true;
 


  parent reply	other threads:[~2018-10-08 22:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-08 22:47 [PATCH net 00/10] rxrpc: Fix packet reception code David Howells
2018-10-08 22:47 ` [PATCH net 01/10] rxrpc: Fix some missed refs to init_net David Howells
2018-10-08 22:47 ` [PATCH net 02/10] rxrpc: Fix the data_ready handler David Howells
2018-10-08 22:47 ` [PATCH net 03/10] rxrpc: Use the UDP encap_rcv hook David Howells
2018-10-08 22:47 ` [PATCH net 04/10] rxrpc: Don't need to take the RCU read lock in the packet receiver David Howells
2018-10-08 22:47 ` [PATCH net 05/10] rxrpc: Don't check RXRPC_CALL_TX_LAST after calling rxrpc_rotate_tx_window() David Howells
2018-10-08 22:48 ` David Howells [this message]
2018-10-08 22:48 ` [PATCH net 07/10] rxrpc: Only take the rwind and mtu values from latest ACK David Howells
2018-10-08 22:48 ` [PATCH net 08/10] rxrpc: Fix connection-level abort handling David Howells
2018-10-08 22:48 ` [PATCH net 09/10] rxrpc: Fix the rxrpc_tx_packet trace line David Howells
2018-10-08 22:48 ` [PATCH net 10/10] rxrpc: Fix the packet reception routine David Howells
2018-10-08 23:00 ` [PATCH net 00/10] rxrpc: Fix packet reception code David Howells
2018-10-08 23:41 ` [PATCH net 10/10] rxrpc: Fix the packet reception routine David Howells
2018-10-09 14:00 ` [PATCH net 02/10] rxrpc: Fix the data_ready handler David Howells
2018-10-11  5:28 ` [PATCH net 00/10] rxrpc: Fix packet reception code David Miller

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=153903888348.17944.12633118494706316191.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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).