[PATCH 25/30] SUNRPC: Delay, then retry on connection errors.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Enforce the comment in xs_tcp_connect_worker4/xs_tcp_connect_worker6 that
we should delay, then retry on certain connection errors.

Signed-off-by: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx>
---

 net/sunrpc/xprtsock.c |   34 ++++++++++++++++------------------
 1 files changed, 16 insertions(+), 18 deletions(-)


diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 8e58b0b..9f3e615 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1722,20 +1722,19 @@ static void xs_tcp_connect_worker4(struct work_struct *work)
 			xprt, -status, xprt_connected(xprt),
 			sock->sk->sk_state);
 	switch (status) {
+	case -ECONNREFUSED:
+	case -ECONNRESET:
+	case -ENETUNREACH:
+		/* retry with existing socket, after a delay */
 	case 0:
 	case -EINPROGRESS:
 	case -EALREADY:
 		goto out_clear;
-	case -ECONNREFUSED:
-	case -ECONNRESET:
-		/* retry with existing socket, after a delay */
-		break;
-	default:
-		/* get rid of existing socket, and retry */
-		xs_tcp_shutdown(xprt);
-		printk("%s: connect returned unhandled error %d\n",
-				__func__, status);
 	}
+	/* get rid of existing socket, and retry */
+	xs_tcp_shutdown(xprt);
+	printk("%s: connect returned unhandled error %d\n",
+			__func__, status);
 	status = -EAGAIN;
 out:
 	xprt_wake_pending_tasks(xprt, status);
@@ -1783,20 +1782,19 @@ static void xs_tcp_connect_worker6(struct work_struct *work)
 	dprintk("RPC:       %p connect status %d connected %d sock state %d\n",
 			xprt, -status, xprt_connected(xprt), sock->sk->sk_state);
 	switch (status) {
+	case -ECONNREFUSED:
+	case -ECONNRESET:
+	case -ENETUNREACH:
+		/* retry with existing socket, after a delay */
 	case 0:
 	case -EINPROGRESS:
 	case -EALREADY:
 		goto out_clear;
-	case -ECONNREFUSED:
-	case -ECONNRESET:
-		/* retry with existing socket, after a delay */
-		break;
-	default:
-		/* get rid of existing socket, and retry */
-		xs_tcp_shutdown(xprt);
-		printk("%s: connect returned unhandled error %d\n",
-				__func__, status);
 	}
+	/* get rid of existing socket, and retry */
+	xs_tcp_shutdown(xprt);
+	printk("%s: connect returned unhandled error %d\n",
+			__func__, status);
 	status = -EAGAIN;
 out:
 	xprt_wake_pending_tasks(xprt, status);

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux