Skip to content

Commit 7d7587d

Browse files
committed
afs: Fix client call Rx-phase signal handling
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>
1 parent dde9f09 commit 7d7587d

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
@@ -604,11 +604,7 @@ static void afs_deliver_to_call(struct afs_call *call)
604604
long afs_wait_for_call_to_complete(struct afs_call *call,
605605
struct afs_addr_cursor *ac)
606606
{
607-
signed long rtt2, timeout;
608607
long ret;
609-
bool stalled = false;
610-
u64 rtt;
611-
u32 life, last_life;
612608
bool rxrpc_complete = false;
613609

614610
DECLARE_WAITQUEUE(myself, current);
@@ -619,14 +615,6 @@ long afs_wait_for_call_to_complete(struct afs_call *call,
619615
if (ret < 0)
620616
goto out;
621617

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

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

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

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

673643
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
@@ -64,9 +64,7 @@ int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
6464
rxrpc_user_attach_call_t, unsigned long, gfp_t,
6565
unsigned int);
6666
void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
67-
bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *,
68-
u32 *);
69-
void rxrpc_kernel_probe_life(struct socket *, struct rxrpc_call *);
67+
bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *);
7068
u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
7169
bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *,
7270
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)