Skip to content

Commit bc0fc2d

Browse files
dhowellsgregkh
authored andcommitted
afs: Fix client call Rx-phase signal handling
commit 7d7587d upstream. Fix the handling of signals in client rxrpc calls made by the afs filesystem. Ignore signals completely, leaving call abandonment or connection loss to be detected by timeouts inside AF_RXRPC. Allowing a filesystem call to be interrupted after the entire request has been transmitted and an abort sent means that the server may or may not have done the action - and we don't know. It may even be worse than that for older servers. Fixes: bc5e3a5 ("rxrpc: Use MSG_WAITALL to tell sendmsg() to temporarily ignore signals") Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a6ca6e6 commit bc0fc2d

5 files changed

Lines changed: 6 additions & 67 deletions

File tree

‎fs/afs/rxrpc.c‎

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -603,11 +603,7 @@ static void afs_deliver_to_call(struct afs_call *call)
603603
long afs_wait_for_call_to_complete(struct afs_call *call,
604604
struct afs_addr_cursor *ac)
605605
{
606-
signed long rtt2, timeout;
607606
long ret;
608-
bool stalled = false;
609-
u64 rtt;
610-
u32 life, last_life;
611607
bool rxrpc_complete = false;
612608

613609
DECLARE_WAITQUEUE(myself, current);
@@ -618,14 +614,6 @@ long afs_wait_for_call_to_complete(struct afs_call *call,
618614
if (ret < 0)
619615
goto out;
620616

621-
rtt = rxrpc_kernel_get_rtt(call->net->socket, call->rxcall);
622-
rtt2 = nsecs_to_jiffies64(rtt) * 2;
623-
if (rtt2 < 2)
624-
rtt2 = 2;
625-
626-
timeout = rtt2;
627-
rxrpc_kernel_check_life(call->net->socket, call->rxcall, &last_life);
628-
629617
add_wait_queue(&call->waitq, &myself);
630618
for (;;) {
631619
set_current_state(TASK_UNINTERRUPTIBLE);
@@ -636,37 +624,19 @@ long afs_wait_for_call_to_complete(struct afs_call *call,
636624
call->need_attention = false;
637625
__set_current_state(TASK_RUNNING);
638626
afs_deliver_to_call(call);
639-
timeout = rtt2;
640627
continue;
641628
}
642629

643630
if (afs_check_call_state(call, AFS_CALL_COMPLETE))
644631
break;
645632

646-
if (!rxrpc_kernel_check_life(call->net->socket, call->rxcall, &life)) {
633+
if (!rxrpc_kernel_check_life(call->net->socket, call->rxcall)) {
647634
/* rxrpc terminated the call. */
648635
rxrpc_complete = true;
649636
break;
650637
}
651638

652-
if (call->intr && timeout == 0 &&
653-
life == last_life && signal_pending(current)) {
654-
if (stalled)
655-
break;
656-
__set_current_state(TASK_RUNNING);
657-
rxrpc_kernel_probe_life(call->net->socket, call->rxcall);
658-
timeout = rtt2;
659-
stalled = true;
660-
continue;
661-
}
662-
663-
if (life != last_life) {
664-
timeout = rtt2;
665-
last_life = life;
666-
stalled = false;
667-
}
668-
669-
timeout = schedule_timeout(timeout);
639+
schedule();
670640
}
671641

672642
remove_wait_queue(&call->waitq, &myself);

‎include/net/af_rxrpc.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
5858
rxrpc_user_attach_call_t, unsigned long, gfp_t,
5959
unsigned int);
6060
void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
61-
bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *,
62-
u32 *);
63-
void rxrpc_kernel_probe_life(struct socket *, struct rxrpc_call *);
61+
bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *);
6462
u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
6563
bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *,
6664
ktime_t *);

‎net/rxrpc/af_rxrpc.c‎

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -371,44 +371,17 @@ EXPORT_SYMBOL(rxrpc_kernel_end_call);
371371
* rxrpc_kernel_check_life - Check to see whether a call is still alive
372372
* @sock: The socket the call is on
373373
* @call: The call to check
374-
* @_life: Where to store the life value
375374
*
376-
* Allow a kernel service to find out whether a call is still alive - ie. we're
377-
* getting ACKs from the server. Passes back in *_life a number representing
378-
* the life state which can be compared to that returned by a previous call and
379-
* return true if the call is still alive.
380-
*
381-
* If the life state stalls, rxrpc_kernel_probe_life() should be called and
382-
* then 2RTT waited.
375+
* Allow a kernel service to find out whether a call is still alive -
376+
* ie. whether it has completed.
383377
*/
384378
bool rxrpc_kernel_check_life(const struct socket *sock,
385-
const struct rxrpc_call *call,
386-
u32 *_life)
379+
const struct rxrpc_call *call)
387380
{
388-
*_life = call->acks_latest;
389381
return call->state != RXRPC_CALL_COMPLETE;
390382
}
391383
EXPORT_SYMBOL(rxrpc_kernel_check_life);
392384

393-
/**
394-
* rxrpc_kernel_probe_life - Poke the peer to see if it's still alive
395-
* @sock: The socket the call is on
396-
* @call: The call to check
397-
*
398-
* In conjunction with rxrpc_kernel_check_life(), allow a kernel service to
399-
* find out whether a call is still alive by pinging it. This should cause the
400-
* life state to be bumped in about 2*RTT.
401-
*
402-
* The must be called in TASK_RUNNING state on pain of might_sleep() objecting.
403-
*/
404-
void rxrpc_kernel_probe_life(struct socket *sock, struct rxrpc_call *call)
405-
{
406-
rxrpc_propose_ACK(call, RXRPC_ACK_PING, 0, true, false,
407-
rxrpc_propose_ack_ping_for_check_life);
408-
rxrpc_send_ack_packet(call, true, NULL);
409-
}
410-
EXPORT_SYMBOL(rxrpc_kernel_probe_life);
411-
412385
/**
413386
* rxrpc_kernel_get_epoch - Retrieve the epoch value from a call.
414387
* @sock: The socket the call is on

‎net/rxrpc/ar-internal.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,6 @@ struct rxrpc_call {
675675

676676
/* transmission-phase ACK management */
677677
ktime_t acks_latest_ts; /* Timestamp of latest ACK received */
678-
rxrpc_serial_t acks_latest; /* serial number of latest ACK received */
679678
rxrpc_seq_t acks_lowest_nak; /* Lowest NACK in the buffer (or ==tx_hard_ack) */
680679
rxrpc_seq_t acks_lost_top; /* tx_top at the time lost-ack ping sent */
681680
rxrpc_serial_t acks_lost_ping; /* Serial number of probe ACK */

‎net/rxrpc/input.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,6 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
882882
before(prev_pkt, call->ackr_prev_seq))
883883
goto out;
884884
call->acks_latest_ts = skb->tstamp;
885-
call->acks_latest = sp->hdr.serial;
886885

887886
call->ackr_first_seq = first_soft_ack;
888887
call->ackr_prev_seq = prev_pkt;

0 commit comments

Comments
 (0)