public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]rpc client can not deal with ENOSOCK, so translate it into ENOCONN
@ 2010-03-06  3:46 Bian Naimeng
       [not found] ` <1267885392.4688.5.camel@localhost.localdomain>
  0 siblings, 1 reply; 4+ messages in thread
From: Bian Naimeng @ 2010-03-06  3:46 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, J. Bruce Fields

If NFSv4 client send a request before connect, or the old connection was broken
because a ETIMEOUT error catched by call_status, ->send_request will return
ENOSOCK, but rpc layer can not deal with it, so translate it into ENOCONN.

Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>

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

diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 3d739e5..45e5fd8 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -549,14 +549,13 @@ static int xs_udp_send_request(struct rpc_task *task)
 		/* Still some bytes left; set up for a retry later. */
 		status = -EAGAIN;
 	}
-	if (!transport->sock)
+	if (!transport->sock || status == -ENOTSOCK) {
+		/* Should we call xs_close() here? */
+		status = -ENOTCONN;
 		goto out;
+	}
 
 	switch (status) {
-	case -ENOTSOCK:
-		status = -ENOTCONN;
-		/* Should we call xs_close() here? */
-		break;
 	case -EAGAIN:
 		status = xs_nospace(task);
 		break;
@@ -652,14 +651,13 @@ static int xs_tcp_send_request(struct rpc_task *task)
 		status = -EAGAIN;
 		break;
 	}
-	if (!transport->sock)
+	if (!transport->sock || status == -ENOTSOCK) {
+		/* Should we call xs_close() here? */
+		status = -ENOTCONN;
 		goto out;
+	}
 
 	switch (status) {
-	case -ENOTSOCK:
-		status = -ENOTCONN;
-		/* Should we call xs_close() here? */
-		break;
 	case -EAGAIN:
 		status = xs_nospace(task);
 		break;
-- 
1.6.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-08  6:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-06  3:46 [PATCH]rpc client can not deal with ENOSOCK, so translate it into ENOCONN Bian Naimeng
     [not found] ` <1267885392.4688.5.camel@localhost.localdomain>
     [not found]   ` <1267885392.4688.5.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-03-08  1:13     ` Bian Naimeng
2010-03-08  1:13     ` [PATCH][V2]rpc " Bian Naimeng
2010-03-08  6:49       ` [PATCH][V3]rpc " Bian Naimeng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox