mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 12:16:20 +00:00
SUNRPC: Handle socket errors correctly
Ensure that we pick up and handle socket errors as they occur. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
c8485e4d63
commit
482f32e65d
1 changed files with 5 additions and 7 deletions
|
@ -1208,23 +1208,20 @@ static void xs_tcp_state_change(struct sock *sk)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xs_tcp_error_report - callback mainly for catching RST events
|
* xs_error_report - callback mainly for catching socket errors
|
||||||
* @sk: socket
|
* @sk: socket
|
||||||
*/
|
*/
|
||||||
static void xs_tcp_error_report(struct sock *sk)
|
static void xs_error_report(struct sock *sk)
|
||||||
{
|
{
|
||||||
struct rpc_xprt *xprt;
|
struct rpc_xprt *xprt;
|
||||||
|
|
||||||
read_lock(&sk->sk_callback_lock);
|
read_lock(&sk->sk_callback_lock);
|
||||||
if (sk->sk_err != ECONNRESET || sk->sk_state != TCP_ESTABLISHED)
|
|
||||||
goto out;
|
|
||||||
if (!(xprt = xprt_from_sock(sk)))
|
if (!(xprt = xprt_from_sock(sk)))
|
||||||
goto out;
|
goto out;
|
||||||
dprintk("RPC: %s client %p...\n"
|
dprintk("RPC: %s client %p...\n"
|
||||||
"RPC: error %d\n",
|
"RPC: error %d\n",
|
||||||
__func__, xprt, sk->sk_err);
|
__func__, xprt, sk->sk_err);
|
||||||
|
xprt_wake_pending_tasks(xprt, -EAGAIN);
|
||||||
xprt_force_disconnect(xprt);
|
|
||||||
out:
|
out:
|
||||||
read_unlock(&sk->sk_callback_lock);
|
read_unlock(&sk->sk_callback_lock);
|
||||||
}
|
}
|
||||||
|
@ -1509,6 +1506,7 @@ static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
|
||||||
sk->sk_user_data = xprt;
|
sk->sk_user_data = xprt;
|
||||||
sk->sk_data_ready = xs_udp_data_ready;
|
sk->sk_data_ready = xs_udp_data_ready;
|
||||||
sk->sk_write_space = xs_udp_write_space;
|
sk->sk_write_space = xs_udp_write_space;
|
||||||
|
sk->sk_error_report = xs_error_report;
|
||||||
sk->sk_no_check = UDP_CSUM_NORCV;
|
sk->sk_no_check = UDP_CSUM_NORCV;
|
||||||
sk->sk_allocation = GFP_ATOMIC;
|
sk->sk_allocation = GFP_ATOMIC;
|
||||||
|
|
||||||
|
@ -1656,7 +1654,7 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
|
||||||
sk->sk_data_ready = xs_tcp_data_ready;
|
sk->sk_data_ready = xs_tcp_data_ready;
|
||||||
sk->sk_state_change = xs_tcp_state_change;
|
sk->sk_state_change = xs_tcp_state_change;
|
||||||
sk->sk_write_space = xs_tcp_write_space;
|
sk->sk_write_space = xs_tcp_write_space;
|
||||||
sk->sk_error_report = xs_tcp_error_report;
|
sk->sk_error_report = xs_error_report;
|
||||||
sk->sk_allocation = GFP_ATOMIC;
|
sk->sk_allocation = GFP_ATOMIC;
|
||||||
|
|
||||||
/* socket options */
|
/* socket options */
|
||||||
|
|
Loading…
Reference in a new issue