]> git.baikalelectronics.ru Git - kernel.git/commit
net/sunrpc/xprt_sock: fix regression in connection error reporting.
authorNeilBrown <neilb@suse.com>
Wed, 19 Jul 2017 04:05:01 +0000 (14:05 +1000)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 21 Jul 2017 12:49:58 +0000 (08:49 -0400)
commitebec7cc9f6892d1d6ea68e657bb2a994b068d1eb
treea906fde05bff9b28dc499c89cb9c799867c86107
parentd24b6868a9526f46d158b90a829b1c452bfabff9
net/sunrpc/xprt_sock: fix regression in connection error reporting.

Commit 13b1e5db302f ("tcp: remove poll() flakes when receiving
RST") in v4.12 changed the order in which ->sk_state_change()
and ->sk_error_report() are called when a socket is shut
down - sk_state_change() is now called first.

This causes xs_tcp_state_change() -> xs_sock_mark_closed() ->
xprt_disconnect_done() to wake all pending tasked with -EAGAIN.
When the ->sk_error_report() callback arrives, it is too late to
pass the error on, and it is lost.

As easy way to demonstrate the problem caused is to try to start
rpc.nfsd while rcpbind isn't running.
nfsd will attempt a tcp connection to rpcbind.  A ECONNREFUSED
error is returned, but sunrpc code loses the error and keeps
retrying.  If it saw the ECONNREFUSED, it would abort.

To fix this, handle the sk->sk_err in the TCP_CLOSE branch of
xs_tcp_state_change().

Fixes: 13b1e5db302f ("tcp: remove poll() flakes when receiving RST")
Cc: stable@vger.kernel.org (v4.12)
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtsock.c