rpc client can not deal with ENOSOCK, so translate it into ENOCONN
Subsystems (3)
PATCH 1/1 rpc client can not deal with ENOSOCK, so translate it into ENOCONN
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.
--- net/sunrpc/xprtsock.c | 18 ++++++++---------- 1 files changed, 8 insertions(+), 10 deletions(-)
net/sunrpc/xprtsock.c +8 -10
@@ -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 ;
Signature · 1 line
1.6.4
Trond Myklebust =8E=CA=93=B9:
Quoted 2 lines
On Sat, 2010-03-06 at 11:46 +0800, Bian Naimeng wrote:=20
Quoted 1 line
If NFSv4 client send a request before connect, or the old connection=
was broken
Quoted 1 line
Quoted 1 line
because a ETIMEOUT error catched by
call_status, ->send_request will=
return
Quoted 1 line
Quoted 1 line
ENOSOCK, but rpc layer can not deal with it, so translate it into EN=
OCONN.
Quoted 4 lines
Quoted 4 lines
Signed-off-by Bian Naimeng <[email protected]>---
=2E.. snip...
Quoted 10 lines
Quoted 10 lines
net/sunrpc/xprtsock.c +4
-1-if (!transport->sock) + if (!transport->sock || status =3D=3D -ENOTSOCK) { +/* Should we call xs_close() here? */ + status =3D -ENOTCONN ; goto out; + }=20
net/sunrpc/xprtsock.c +0
-2switch (status) { -case -ENOTSOCK : - status =3D -ENOTCONN ;
Quoted 8 lines
net/sunrpc/xprtsock.c static int xs_udp_send_request(struct rpc_task *task) · line 561
Quoted 5 lines
net/sunrpc/xprtsock.c +0
-2-/* Should we call xs_close() here? */ -break ;case -EAGAIN : status =3D xs_nospace(task);break ;=20
The only case wherexs_sendpages()will return ENOTSOCK is iftransport->sock=3D=3D NULL, so the correct fix here is to just remov=
e that
Quoted 2 lines
redundant test. There is no need to move the test for ENOTSOCK out of the switch statement.
Yes. Thanks for your suggestion.
Best Regards
Bian
Quoted 3 lines
=20
Cheers
Trond
PATCH v2 1/1 rpc client can not deal with ENOSOCK, so translate it into ENOCONN
In reply to a message not in the archiveIf 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.
--- net/sunrpc/xprtsock.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
net/sunrpc/xprtsock.c +0 -4
@@ -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 :
@@ -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 :
Signature · 1 line
1.6.4
PATCH v3 1/1 rpc client can not deal with ENOSOCK, so translate it into ENOCONN
Sorry, I need remove the unused lable "out:".
---
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.
--- net/sunrpc/xprtsock.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)
net/sunrpc/xprtsock.c +2 -6
@@ -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 :
@@ -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; }
@@ -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 :
@@ -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; }
Signature · 1 line
1.6.4