[PATCH 1/2] RxRPC: Don't attempt to reuse aborted connections

Subsystems: networking [general], rxrpc sockets (af_rxrpc), the rest

STALE6289d

2 messages, 1 author, 2009-06-16 · open the first message on its own page

[PATCH 1/2] RxRPC: Don't attempt to reuse aborted connections

From: David Howells <dhowells@redhat.com>
Date: 2009-06-16 20:38:16

Connections that have seen a connection-level abort should not be reused as the
far end will just abort them again; instead a new connection should be made.

Connection-level aborts occur due to such things as authentication failures.

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

 net/rxrpc/ar-connection.c |   10 ++++++++++
 net/rxrpc/ar-connevent.c  |    7 ++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/net/rxrpc/ar-connection.c b/net/rxrpc/ar-connection.c
index 67e38a0..9f1ce84 100644
--- a/net/rxrpc/ar-connection.c
+++ b/net/rxrpc/ar-connection.c
@@ -444,6 +444,11 @@ int rxrpc_connect_call(struct rxrpc_sock *rx,
 			conn = list_entry(bundle->avail_conns.next,
 					  struct rxrpc_connection,
 					  bundle_link);
+			if (conn->state >= RXRPC_CONN_REMOTELY_ABORTED) {
+				list_del_init(&conn->bundle_link);
+				bundle->num_conns--;
+				continue;
+			}
 			if (--conn->avail_calls == 0)
 				list_move(&conn->bundle_link,
 					  &bundle->busy_conns);
@@ -461,6 +466,11 @@ int rxrpc_connect_call(struct rxrpc_sock *rx,
 			conn = list_entry(bundle->unused_conns.next,
 					  struct rxrpc_connection,
 					  bundle_link);
+			if (conn->state >= RXRPC_CONN_REMOTELY_ABORTED) {
+				list_del_init(&conn->bundle_link);
+				bundle->num_conns--;
+				continue;
+			}
 			ASSERTCMP(conn->avail_calls, ==, RXRPC_MAXCALLS);
 			conn->avail_calls = RXRPC_MAXCALLS - 1;
 			ASSERT(conn->channels[0] == NULL &&
diff --git a/net/rxrpc/ar-connevent.c b/net/rxrpc/ar-connevent.c
index dc5cb1e..0505cdc 100644
--- a/net/rxrpc/ar-connevent.c
+++ b/net/rxrpc/ar-connevent.c
@@ -150,11 +150,15 @@ static int rxrpc_process_event(struct rxrpc_connection *conn,
 	u32 serial;
 	int loop, ret;
 
-	if (conn->state >= RXRPC_CONN_REMOTELY_ABORTED)
+	if (conn->state >= RXRPC_CONN_REMOTELY_ABORTED) {
+		kleave(" = -ECONNABORTED [%u]", conn->state);
 		return -ECONNABORTED;
+	}
 
 	serial = ntohl(sp->hdr.serial);
 
+	_enter("{%d},{%u,%%%u},", conn->debug_id, sp->hdr.type, serial);
+
 	switch (sp->hdr.type) {
 	case RXRPC_PACKET_TYPE_ABORT:
 		if (skb_copy_bits(skb, 0, &tmp, sizeof(tmp)) < 0)
@@ -199,6 +203,7 @@ static int rxrpc_process_event(struct rxrpc_connection *conn,
 		return 0;
 
 	default:
+		_leave(" = -EPROTO [%u]", sp->hdr.type);
 		return -EPROTO;
 	}
 }

[PATCH 2/2] AFS: Correctly translate auth error aborts and don't failover in such cases

From: David Howells <dhowells@redhat.com>
Date: 2009-06-16 20:38:31

Authentication error abort codes should be translated to appropriate Linux
error codes, rather than all being translated to EREMOTEIO - which indicates
that the server had internal problems.

Additionally, a server shouldn't be marked unavailable and the next server
tried if an authentication error occurs.  This will quickly make all the
servers unavailable to the client.  Instead the error should be returned
straight to the user.

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

 fs/afs/misc.c      |   16 ++++++++++++++++
 fs/afs/vlocation.c |    2 ++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/fs/afs/misc.c b/fs/afs/misc.c
index 2d33a5f..0dd4daf 100644
--- a/fs/afs/misc.c
+++ b/fs/afs/misc.c
@@ -12,6 +12,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/errno.h>
+#include <rxrpc/packet.h>
 #include "internal.h"
 #include "afs_fs.h"
 
@@ -54,6 +55,21 @@ int afs_abort_to_error(u32 abort_code)
 	case 0x2f6df24:		return -ENOLCK;
 	case 0x2f6df26:		return -ENOTEMPTY;
 	case 0x2f6df78:		return -EDQUOT;
+
+	case RXKADINCONSISTENCY: return -EPROTO;
+	case RXKADPACKETSHORT:	return -EPROTO;
+	case RXKADLEVELFAIL:	return -EKEYREJECTED;
+	case RXKADTICKETLEN:	return -EKEYREJECTED;
+	case RXKADOUTOFSEQUENCE: return -EPROTO;
+	case RXKADNOAUTH:	return -EKEYREJECTED;
+	case RXKADBADKEY:	return -EKEYREJECTED;
+	case RXKADBADTICKET:	return -EKEYREJECTED;
+	case RXKADUNKNOWNKEY:	return -EKEYREJECTED;
+	case RXKADEXPIRED:	return -EKEYEXPIRED;
+	case RXKADSEALEDINCON:	return -EKEYREJECTED;
+	case RXKADDATALEN:	return -EKEYREJECTED;
+	case RXKADILLEGALLEVEL:	return -EKEYREJECTED;
+
 	default:		return -EREMOTEIO;
 	}
 }
diff --git a/fs/afs/vlocation.c b/fs/afs/vlocation.c
index ec2a743..6e68920 100644
--- a/fs/afs/vlocation.c
+++ b/fs/afs/vlocation.c
@@ -65,6 +65,8 @@ static int afs_vlocation_access_vl_by_name(struct afs_vlocation *vl,
 				goto out;
 			goto rotate;
 		case -ENOMEDIUM:
+		case -EKEYREJECTED:
+		case -EKEYEXPIRED:
 			goto out;
 		default:
 			ret = -EIO;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help