mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
rxrpc: Remove call->state_lock
All the setters of call->state are now in the I/O thread and thus the state lock is now unnecessary. Signed-off-by: David Howells <dhowells@redhat.com> cc: Marc Dionne <marc.dionne@auristor.com> cc: linux-afs@lists.infradead.org
This commit is contained in:
@@ -69,7 +69,7 @@ static void rxrpc_call_timer_expired(struct timer_list *t)
|
||||
|
||||
_enter("%d", call->debug_id);
|
||||
|
||||
if (call->state < RXRPC_CALL_COMPLETE) {
|
||||
if (!__rxrpc_call_is_complete(call)) {
|
||||
trace_rxrpc_timer_expired(call, jiffies);
|
||||
rxrpc_poke_call(call, rxrpc_call_poke_timer);
|
||||
}
|
||||
@@ -162,7 +162,6 @@ struct rxrpc_call *rxrpc_alloc_call(struct rxrpc_sock *rx, gfp_t gfp,
|
||||
init_waitqueue_head(&call->waitq);
|
||||
spin_lock_init(&call->notify_lock);
|
||||
spin_lock_init(&call->tx_lock);
|
||||
rwlock_init(&call->state_lock);
|
||||
refcount_set(&call->ref, 1);
|
||||
call->debug_id = debug_id;
|
||||
call->tx_total_len = -1;
|
||||
@@ -211,7 +210,6 @@ static struct rxrpc_call *rxrpc_alloc_client_call(struct rxrpc_sock *rx,
|
||||
now = ktime_get_real();
|
||||
call->acks_latest_ts = now;
|
||||
call->cong_tstamp = now;
|
||||
call->state = RXRPC_CALL_CLIENT_AWAIT_CONN;
|
||||
call->dest_srx = *srx;
|
||||
call->interruptibility = p->interruptibility;
|
||||
call->tx_total_len = p->tx_total_len;
|
||||
@@ -227,11 +225,13 @@ static struct rxrpc_call *rxrpc_alloc_client_call(struct rxrpc_sock *rx,
|
||||
|
||||
ret = rxrpc_init_client_call_security(call);
|
||||
if (ret < 0) {
|
||||
__rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, 0, ret);
|
||||
rxrpc_prefail_call(call, RXRPC_CALL_LOCAL_ERROR, ret);
|
||||
rxrpc_put_call(call, rxrpc_call_put_discard_error);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
rxrpc_set_call_state(call, RXRPC_CALL_CLIENT_AWAIT_CONN);
|
||||
|
||||
trace_rxrpc_call(call->debug_id, refcount_read(&call->ref),
|
||||
p->user_call_ID, rxrpc_call_new_client);
|
||||
|
||||
@@ -384,8 +384,7 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx,
|
||||
error_dup_user_ID:
|
||||
write_unlock(&rx->call_lock);
|
||||
release_sock(&rx->sk);
|
||||
__rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR,
|
||||
RX_CALL_DEAD, -EEXIST);
|
||||
rxrpc_prefail_call(call, RXRPC_CALL_LOCAL_ERROR, -EEXIST);
|
||||
trace_rxrpc_call(call->debug_id, refcount_read(&call->ref), 0,
|
||||
rxrpc_call_see_userid_exists);
|
||||
rxrpc_release_call(rx, call);
|
||||
@@ -403,8 +402,7 @@ error_attached_to_socket:
|
||||
trace_rxrpc_call(call->debug_id, refcount_read(&call->ref), ret,
|
||||
rxrpc_call_see_connect_failed);
|
||||
set_bit(RXRPC_CALL_DISCONNECTED, &call->flags);
|
||||
__rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR,
|
||||
RX_CALL_DEAD, ret);
|
||||
rxrpc_prefail_call(call, RXRPC_CALL_LOCAL_ERROR, ret);
|
||||
_leave(" = c=%08x [err]", call->debug_id);
|
||||
return call;
|
||||
}
|
||||
@@ -427,25 +425,25 @@ void rxrpc_incoming_call(struct rxrpc_sock *rx,
|
||||
call->call_id = sp->hdr.callNumber;
|
||||
call->dest_srx.srx_service = sp->hdr.serviceId;
|
||||
call->cid = sp->hdr.cid;
|
||||
call->state = RXRPC_CALL_SERVER_SECURING;
|
||||
call->cong_tstamp = skb->tstamp;
|
||||
|
||||
__set_bit(RXRPC_CALL_EXPOSED, &call->flags);
|
||||
rxrpc_set_call_state(call, RXRPC_CALL_SERVER_SECURING);
|
||||
|
||||
spin_lock(&conn->state_lock);
|
||||
|
||||
switch (conn->state) {
|
||||
case RXRPC_CONN_SERVICE_UNSECURED:
|
||||
case RXRPC_CONN_SERVICE_CHALLENGING:
|
||||
call->state = RXRPC_CALL_SERVER_SECURING;
|
||||
rxrpc_set_call_state(call, RXRPC_CALL_SERVER_SECURING);
|
||||
break;
|
||||
case RXRPC_CONN_SERVICE:
|
||||
call->state = RXRPC_CALL_SERVER_RECV_REQUEST;
|
||||
rxrpc_set_call_state(call, RXRPC_CALL_SERVER_RECV_REQUEST);
|
||||
break;
|
||||
|
||||
case RXRPC_CONN_ABORTED:
|
||||
__rxrpc_set_call_completion(call, conn->completion,
|
||||
conn->abort_code, conn->error);
|
||||
rxrpc_set_call_completion(call, conn->completion,
|
||||
conn->abort_code, conn->error);
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
@@ -614,7 +612,7 @@ void rxrpc_put_call(struct rxrpc_call *call, enum rxrpc_call_trace why)
|
||||
dead = __refcount_dec_and_test(&call->ref, &r);
|
||||
trace_rxrpc_call(debug_id, r - 1, 0, why);
|
||||
if (dead) {
|
||||
ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE);
|
||||
ASSERTCMP(__rxrpc_call_state(call), ==, RXRPC_CALL_COMPLETE);
|
||||
|
||||
if (!list_empty(&call->link)) {
|
||||
spin_lock(&rxnet->call_lock);
|
||||
@@ -677,7 +675,7 @@ void rxrpc_cleanup_call(struct rxrpc_call *call)
|
||||
{
|
||||
memset(&call->sock_node, 0xcd, sizeof(call->sock_node));
|
||||
|
||||
ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE);
|
||||
ASSERTCMP(__rxrpc_call_state(call), ==, RXRPC_CALL_COMPLETE);
|
||||
ASSERT(test_bit(RXRPC_CALL_RELEASED, &call->flags));
|
||||
|
||||
del_timer(&call->timer);
|
||||
@@ -715,7 +713,7 @@ void rxrpc_destroy_all_calls(struct rxrpc_net *rxnet)
|
||||
|
||||
pr_err("Call %p still in use (%d,%s,%lx,%lx)!\n",
|
||||
call, refcount_read(&call->ref),
|
||||
rxrpc_call_states[call->state],
|
||||
rxrpc_call_states[__rxrpc_call_state(call)],
|
||||
call->flags, call->events);
|
||||
|
||||
spin_unlock(&rxnet->call_lock);
|
||||
|
||||
Reference in New Issue
Block a user