@@ -189,7 +189,6 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
189
189
struct rxrpc_txbuf * txb ,
190
190
rxrpc_notify_end_tx_t notify_end_tx )
191
191
{
192
- unsigned long now ;
193
192
rxrpc_seq_t seq = txb -> seq ;
194
193
bool last = test_bit (RXRPC_TXBUF_LAST , & txb -> flags ), poke ;
195
194
@@ -212,36 +211,10 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
212
211
poke = list_empty (& call -> tx_sendmsg );
213
212
list_add_tail (& txb -> call_link , & call -> tx_sendmsg );
214
213
call -> tx_prepared = seq ;
214
+ if (last )
215
+ rxrpc_notify_end_tx (rx , call , notify_end_tx );
215
216
spin_unlock (& call -> tx_lock );
216
217
217
- if (last || call -> state == RXRPC_CALL_SERVER_ACK_REQUEST ) {
218
- _debug ("________awaiting reply/ACK__________" );
219
- write_lock (& call -> state_lock );
220
- switch (call -> state ) {
221
- case RXRPC_CALL_CLIENT_SEND_REQUEST :
222
- call -> state = RXRPC_CALL_CLIENT_AWAIT_REPLY ;
223
- rxrpc_notify_end_tx (rx , call , notify_end_tx );
224
- break ;
225
- case RXRPC_CALL_SERVER_ACK_REQUEST :
226
- call -> state = RXRPC_CALL_SERVER_SEND_REPLY ;
227
- now = jiffies ;
228
- WRITE_ONCE (call -> delay_ack_at , now + MAX_JIFFY_OFFSET );
229
- if (call -> ackr_reason == RXRPC_ACK_DELAY )
230
- call -> ackr_reason = 0 ;
231
- trace_rxrpc_timer (call , rxrpc_timer_init_for_send_reply , now );
232
- if (!last )
233
- break ;
234
- fallthrough ;
235
- case RXRPC_CALL_SERVER_SEND_REPLY :
236
- call -> state = RXRPC_CALL_SERVER_AWAIT_ACK ;
237
- rxrpc_notify_end_tx (rx , call , notify_end_tx );
238
- break ;
239
- default :
240
- break ;
241
- }
242
- write_unlock (& call -> state_lock );
243
- }
244
-
245
218
if (poke )
246
219
rxrpc_poke_call (call , rxrpc_call_poke_start );
247
220
}
@@ -280,8 +253,13 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
280
253
ret = - EPROTO ;
281
254
if (state != RXRPC_CALL_CLIENT_SEND_REQUEST &&
282
255
state != RXRPC_CALL_SERVER_ACK_REQUEST &&
283
- state != RXRPC_CALL_SERVER_SEND_REPLY )
256
+ state != RXRPC_CALL_SERVER_SEND_REPLY ) {
257
+ /* Request phase complete for this client call */
258
+ trace_rxrpc_abort (call -> debug_id , rxrpc_sendmsg_late_send ,
259
+ call -> cid , call -> call_id , call -> rx_consumed ,
260
+ 0 , - EPROTO );
284
261
goto maybe_error ;
262
+ }
285
263
286
264
ret = - EMSGSIZE ;
287
265
if (call -> tx_total_len != -1 ) {
@@ -573,7 +551,6 @@ rxrpc_new_client_call_for_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg,
573
551
int rxrpc_do_sendmsg (struct rxrpc_sock * rx , struct msghdr * msg , size_t len )
574
552
__releases (& rx - > sk .sk_lock .slock )
575
553
{
576
- enum rxrpc_call_state state ;
577
554
struct rxrpc_call * call ;
578
555
unsigned long now , j ;
579
556
bool dropped_lock = false;
@@ -672,11 +649,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
672
649
break ;
673
650
}
674
651
675
- state = rxrpc_call_state (call );
676
- _debug ("CALL %d USR %lx ST %d on CONN %p" ,
677
- call -> debug_id , call -> user_call_ID , state , call -> conn );
678
-
679
- if (state >= RXRPC_CALL_COMPLETE ) {
652
+ if (rxrpc_call_is_complete (call )) {
680
653
/* it's too late for this call */
681
654
ret = - ESHUTDOWN ;
682
655
} else if (p .command == RXRPC_CMD_SEND_ABORT ) {
@@ -722,7 +695,7 @@ int rxrpc_kernel_send_data(struct socket *sock, struct rxrpc_call *call,
722
695
bool dropped_lock = false;
723
696
int ret ;
724
697
725
- _enter ("{%d,%s }," , call -> debug_id , rxrpc_call_states [ call -> state ] );
698
+ _enter ("{%d}," , call -> debug_id );
726
699
727
700
ASSERTCMP (msg -> msg_name , = = , NULL );
728
701
ASSERTCMP (msg -> msg_control , = = , NULL );
@@ -732,26 +705,10 @@ int rxrpc_kernel_send_data(struct socket *sock, struct rxrpc_call *call,
732
705
_debug ("CALL %d USR %lx ST %d on CONN %p" ,
733
706
call -> debug_id , call -> user_call_ID , call -> state , call -> conn );
734
707
735
- switch (rxrpc_call_state (call )) {
736
- case RXRPC_CALL_CLIENT_SEND_REQUEST :
737
- case RXRPC_CALL_SERVER_ACK_REQUEST :
738
- case RXRPC_CALL_SERVER_SEND_REPLY :
739
- ret = rxrpc_send_data (rxrpc_sk (sock -> sk ), call , msg , len ,
740
- notify_end_tx , & dropped_lock );
741
- break ;
742
- case RXRPC_CALL_COMPLETE :
743
- read_lock (& call -> state_lock );
708
+ ret = rxrpc_send_data (rxrpc_sk (sock -> sk ), call , msg , len ,
709
+ notify_end_tx , & dropped_lock );
710
+ if (ret == - ESHUTDOWN )
744
711
ret = call -> error ;
745
- read_unlock (& call -> state_lock );
746
- break ;
747
- default :
748
- /* Request phase complete for this client call */
749
- trace_rxrpc_abort (call -> debug_id , rxrpc_sendmsg_late_send ,
750
- call -> cid , call -> call_id , call -> rx_consumed ,
751
- 0 , - EPROTO );
752
- ret = - EPROTO ;
753
- break ;
754
- }
755
712
756
713
if (!dropped_lock )
757
714
mutex_unlock (& call -> user_mutex );
0 commit comments