Skip to content

Commit

Permalink
rpc client can not deal with ENOSOCK, so translate it into ENOCONN
Browse files Browse the repository at this point in the history
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 make sure ->send_request can
translate ENOSOCK into ENOCONN.

Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Bian Naimeng authored and Trond Myklebust committed Mar 8, 2010
1 parent 25cf84c commit 5fe46e9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions net/sunrpc/xprtsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,6 @@ 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)
goto out;

switch (status) {
case -ENOTSOCK:
Expand All @@ -570,7 +568,7 @@ static int xs_udp_send_request(struct rpc_task *task)
* prompts ECONNREFUSED. */
clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags);
}
out:

return status;
}

Expand Down Expand Up @@ -652,8 +650,6 @@ static int xs_tcp_send_request(struct rpc_task *task)
status = -EAGAIN;
break;
}
if (!transport->sock)
goto out;

switch (status) {
case -ENOTSOCK:
Expand All @@ -673,7 +669,7 @@ static int xs_tcp_send_request(struct rpc_task *task)
case -ENOTCONN:
clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags);
}
out:

return status;
}

Expand Down

0 comments on commit 5fe46e9

Please sign in to comment.