public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Bian Naimeng <biannm@cn.fujitsu.com>
To: Trond.Myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, "J. Bruce Fields" <bfields@fieldses.org>
Subject: [PATCH]rpc client can not deal with ENOSOCK, so translate it into ENOCONN
Date: Sat, 06 Mar 2010 11:46:34 +0800	[thread overview]
Message-ID: <4B91D01A.5010800@cn.fujitsu.com> (raw)

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


             reply	other threads:[~2010-03-06  3:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-06  3:46 Bian Naimeng [this message]
     [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     ` [PATCH]rpc client can not deal with ENOSOCK, so translate it into ENOCONN Bian Naimeng
2010-03-08  1:13     ` [PATCH][V2]rpc " Bian Naimeng
2010-03-08  6:49       ` [PATCH][V3]rpc " Bian Naimeng

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=4B91D01A.5010800@cn.fujitsu.com \
    --to=biannm@cn.fujitsu.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox