Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1476036

[PATCH net-next 3/9] rxrpc: The client call state must be changed before attachment to conn

From David Howells <dhowells@redhat.com>
Newsgroups linux.kernel
Subject [PATCH net-next 3/9] rxrpc: The client call state must be changed before attachment to conn
Date 2016-09-04 23:20 +0200
Message-ID <sdMZz-2No-1@gated-at.bofh.it> (permalink)
References <sdMPU-2JV-11@gated-at.bofh.it>
Organization Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903

Show all headers | View raw


We must set the client call state to RXRPC_CALL_CLIENT_SEND_REQUEST before
attaching the call to the connection struct, not after, as it's liable to
receive errors and conn aborts as soon as the assignment is made - and
these will cause its state to be changed outside of the initiating thread's
control.

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

 net/rxrpc/call_object.c |    2 --
 net/rxrpc/conn_client.c |    4 ++++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c
index 57e00fc9cff2..65691742199b 100644
--- a/net/rxrpc/call_object.c
+++ b/net/rxrpc/call_object.c
@@ -197,8 +197,6 @@ static int rxrpc_begin_client_call(struct rxrpc_call *call,
 	if (ret < 0)
 		return ret;
 
-	call->state = RXRPC_CALL_CLIENT_SEND_REQUEST;
-
 	spin_lock(&call->conn->params.peer->lock);
 	hlist_add_head(&call->error_link, &call->conn->params.peer->error_targets);
 	spin_unlock(&call->conn->params.peer->lock);
diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c
index 4b213bc0f554..e19804dd6c8d 100644
--- a/net/rxrpc/conn_client.c
+++ b/net/rxrpc/conn_client.c
@@ -537,6 +537,10 @@ static void rxrpc_activate_one_channel(struct rxrpc_connection *conn,
 					     struct rxrpc_call, chan_wait_link);
 	u32 call_id = chan->call_counter + 1;
 
+	write_lock_bh(&call->state_lock);
+	call->state = RXRPC_CALL_CLIENT_SEND_REQUEST;
+	write_unlock_bh(&call->state_lock);
+
 	rxrpc_see_call(call);
 	list_del_init(&call->chan_wait_link);
 	conn->active_chans |= 1 << channel;

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 0/9] rxrpc: Small fixes David Howells <dhowells@redhat.com> - 2016-09-04 23:10 +0200
  [PATCH net-next 9/9] fs/afs/flock: Remove deprecated  create_singlethread_workqueue David Howells <dhowells@redhat.com> - 2016-09-04 23:10 +0200
  [PATCH net-next 5/9] rxrpc: Don't change the epoch David Howells <dhowells@redhat.com> - 2016-09-04 23:10 +0200
  [PATCH net-next 6/9] fs/afs/vlocation: Remove deprecated  create_singlethread_workqueue David Howells <dhowells@redhat.com> - 2016-09-04 23:20 +0200
  [PATCH net-next 3/9] rxrpc: The client call state must be changed  before attachment to conn David Howells <dhowells@redhat.com> - 2016-09-04 23:20 +0200
  [PATCH net-next 4/9] rxrpc: Randomise epoch and starting client  conn ID values David Howells <dhowells@redhat.com> - 2016-09-04 23:20 +0200
    RE: [PATCH net-next 4/9] rxrpc: Randomise epoch and starting client  conn ID values David Laight <David.Laight@ACULAB.COM> - 2016-09-05 17:10 +0200
      Re: [PATCH net-next 4/9] rxrpc: Randomise epoch and starting client conn ID values David Howells <dhowells@redhat.com> - 2016-09-05 18:30 +0200
        Re: [PATCH net-next 4/9] rxrpc: Randomise epoch and starting client  conn ID values Jeffrey Altman <jaltman@auristor.com> - 2016-09-06 04:20 +0200
  [PATCH net-next 7/9] fs/afs/rxrpc: Remove deprecated  create_singlethread_workqueue David Howells <dhowells@redhat.com> - 2016-09-04 23:20 +0200
  [PATCH net-next 8/9] fs/afs/callback: Remove deprecated  create_singlethread_workqueue David Howells <dhowells@redhat.com> - 2016-09-04 23:20 +0200
  Re: [PATCH net-next 0/9] rxrpc: Small fixes David Miller <davem@davemloft.net> - 2016-09-06 23:00 +0200

csiph-web