All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: netdev@vger.kernel.org
Cc: dhowells@redhat.com, linux-afs@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH net 07/13] rxrpc: Partially handle OpenAFS's improper termination of calls
Date: Thu, 06 Oct 2016 11:04:45 +0100	[thread overview]
Message-ID: <147574828564.30350.1649444077912544776.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <147574823645.30350.16131031458272035074.stgit@warthog.procyon.org.uk>

OpenAFS doesn't always correctly terminate client calls that it makes -
this includes calls the OpenAFS servers make to the cache manager service.
It should end the client call with either:

 (1) An ACK that has firstPacket set to one greater than the seq number of
     the reply DATA packet with the LAST_PACKET flag set (thereby
     hard-ACK'ing all packets).  nAcks should be 0 and acks[] should be
     empty (ie. no soft-ACKs).

 (2) An ACKALL packet.

OpenAFS, though, may send an ACK packet with firstPacket set to the last
seq number or less and soft-ACKs listed for all packets up to and including
the last DATA packet.

The transmitter, however, is obliged to keep the call live and the
soft-ACK'd DATA packets around until they're hard-ACK'd as the receiver is
permitted to drop any merely soft-ACK'd packet and request retransmission
by sending an ACK packet with a NACK in it.

Further, OpenAFS will also terminate a client call by beginning the next
client call on the same connection channel.  This implicitly completes the
previous call.

This patch handles implicit ACK of a call on a channel by the reception of
the first packet of the next call on that channel.

If another call doesn't come along to implicitly ACK a call, then we have
to time the call out.  There are some bugs there that will be addressed in
subsequent patches.

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

 net/rxrpc/input.c |   37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index a6da83f036d6..44fb8d893c7d 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -939,6 +939,33 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call,
 }
 
 /*
+ * Handle a new call on a channel implicitly completing the preceding call on
+ * that channel.
+ *
+ * TODO: If callNumber > call_id + 1, renegotiate security.
+ */
+static void rxrpc_input_implicit_end_call(struct rxrpc_connection *conn,
+					  struct rxrpc_call *call)
+{
+	switch (call->state) {
+	case RXRPC_CALL_SERVER_AWAIT_ACK:
+		rxrpc_call_completed(call);
+		break;
+	case RXRPC_CALL_COMPLETE:
+		break;
+	default:
+		if (rxrpc_abort_call("IMP", call, 0, RX_CALL_DEAD, ESHUTDOWN)) {
+			set_bit(RXRPC_CALL_EV_ABORT, &call->events);
+			rxrpc_queue_call(call);
+		}
+		break;
+	}
+
+	__rxrpc_disconnect_call(conn, call);
+	rxrpc_notify_socket(call);
+}
+
+/*
  * post connection-level events to the connection
  * - this includes challenges, responses, some aborts and call terminal packet
  *   retransmission.
@@ -1146,6 +1173,16 @@ void rxrpc_data_ready(struct sock *udp_sk)
 		}
 
 		call = rcu_dereference(chan->call);
+
+		if (sp->hdr.callNumber > chan->call_id) {
+			if (!(sp->hdr.flags & RXRPC_CLIENT_INITIATED)) {
+				rcu_read_unlock();
+				goto reject_packet;
+			}
+			if (call)
+				rxrpc_input_implicit_end_call(conn, call);
+			call = NULL;
+		}
 	} else {
 		skew = 0;
 		call = NULL;

  parent reply	other threads:[~2016-10-06 10:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06 10:03 [PATCH net-next 00/13] rxrpc: Fixes David Howells
2016-10-06 10:04 ` [PATCH net 01/13] rxrpc: Accesses of rxrpc_local::service need to be RCU managed David Howells
2016-10-06 10:04 ` [PATCH net 02/13] rxrpc: Fix duplicate const David Howells
2016-10-06 10:04 ` [PATCH net 03/13] rxrpc: Fix oops on incoming call to serviceless endpoint David Howells
2016-10-06 10:04 ` [PATCH net 04/13] rxrpc: Only ping for lost reply in client call David Howells
2016-10-06 10:04 ` [PATCH net 05/13] rxrpc: Fix warning by splitting rxrpc_send_call_packet() David Howells
2016-10-06 10:04 ` [PATCH net 06/13] rxrpc: Fix loss of PING RESPONSE ACK production due to PING ACKs David Howells
2016-10-06 10:04 ` David Howells [this message]
2016-10-06 10:04 ` [PATCH net 08/13] rxrpc: Queue the call on expiry David Howells
2016-10-06 10:04 ` [PATCH net 09/13] rxrpc: Add missing notification David Howells
2016-10-06 10:05 ` [PATCH net 10/13] rxrpc: Return negative error code to kernel service David Howells
2016-10-06 10:05 ` [PATCH net 11/13] afs: Check for fatal error when in waiting for ack state David Howells
2016-10-06 10:05 ` [PATCH net 12/13] rxrpc: Need to produce an ACK for service op if op takes a long time David Howells
2016-10-06 10:05 ` [PATCH net 13/13] rxrpc: Don't request an ACK on the last DATA packet of a call's Tx phase David Howells
2016-10-07  1:04 ` [PATCH net-next 00/13] rxrpc: Fixes David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=147574828564.30350.1649444077912544776.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.