SUNRPC: Replace internal use of SOCKWQ_ASYNC_NOSPACE
The socket's SOCKWQ_ASYNC_NOSPACE can be cleared by various actors in the socket layer, so replace it with our own flag in the transport sock_state field. Reported-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
Родитель
7496b59f58
Коммит
2790a624d4
|
@ -90,5 +90,6 @@ struct sock_xprt {
|
||||||
#define XPRT_SOCK_WAKE_PENDING (6)
|
#define XPRT_SOCK_WAKE_PENDING (6)
|
||||||
#define XPRT_SOCK_WAKE_DISCONNECT (7)
|
#define XPRT_SOCK_WAKE_DISCONNECT (7)
|
||||||
#define XPRT_SOCK_CONNECT_SENT (8)
|
#define XPRT_SOCK_CONNECT_SENT (8)
|
||||||
|
#define XPRT_SOCK_NOSPACE (9)
|
||||||
|
|
||||||
#endif /* _LINUX_SUNRPC_XPRTSOCK_H */
|
#endif /* _LINUX_SUNRPC_XPRTSOCK_H */
|
||||||
|
|
|
@ -780,14 +780,8 @@ static int xs_nospace(struct rpc_rqst *req, struct sock_xprt *transport)
|
||||||
|
|
||||||
/* Don't race with disconnect */
|
/* Don't race with disconnect */
|
||||||
if (xprt_connected(xprt)) {
|
if (xprt_connected(xprt)) {
|
||||||
struct socket_wq *wq;
|
|
||||||
|
|
||||||
rcu_read_lock();
|
|
||||||
wq = rcu_dereference(sk->sk_wq);
|
|
||||||
set_bit(SOCKWQ_ASYNC_NOSPACE, &wq->flags);
|
|
||||||
rcu_read_unlock();
|
|
||||||
|
|
||||||
/* wait for more buffer space */
|
/* wait for more buffer space */
|
||||||
|
set_bit(XPRT_SOCK_NOSPACE, &transport->sock_state);
|
||||||
set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
|
set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
|
||||||
sk->sk_write_pending++;
|
sk->sk_write_pending++;
|
||||||
xprt_wait_for_buffer_space(xprt);
|
xprt_wait_for_buffer_space(xprt);
|
||||||
|
@ -1151,6 +1145,7 @@ static void xs_sock_reset_state_flags(struct rpc_xprt *xprt)
|
||||||
clear_bit(XPRT_SOCK_WAKE_ERROR, &transport->sock_state);
|
clear_bit(XPRT_SOCK_WAKE_ERROR, &transport->sock_state);
|
||||||
clear_bit(XPRT_SOCK_WAKE_WRITE, &transport->sock_state);
|
clear_bit(XPRT_SOCK_WAKE_WRITE, &transport->sock_state);
|
||||||
clear_bit(XPRT_SOCK_WAKE_DISCONNECT, &transport->sock_state);
|
clear_bit(XPRT_SOCK_WAKE_DISCONNECT, &transport->sock_state);
|
||||||
|
clear_bit(XPRT_SOCK_NOSPACE, &transport->sock_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xs_run_error_worker(struct sock_xprt *transport, unsigned int nr)
|
static void xs_run_error_worker(struct sock_xprt *transport, unsigned int nr)
|
||||||
|
@ -1497,7 +1492,6 @@ static void xs_tcp_state_change(struct sock *sk)
|
||||||
|
|
||||||
static void xs_write_space(struct sock *sk)
|
static void xs_write_space(struct sock *sk)
|
||||||
{
|
{
|
||||||
struct socket_wq *wq;
|
|
||||||
struct sock_xprt *transport;
|
struct sock_xprt *transport;
|
||||||
struct rpc_xprt *xprt;
|
struct rpc_xprt *xprt;
|
||||||
|
|
||||||
|
@ -1508,15 +1502,10 @@ static void xs_write_space(struct sock *sk)
|
||||||
if (unlikely(!(xprt = xprt_from_sock(sk))))
|
if (unlikely(!(xprt = xprt_from_sock(sk))))
|
||||||
return;
|
return;
|
||||||
transport = container_of(xprt, struct sock_xprt, xprt);
|
transport = container_of(xprt, struct sock_xprt, xprt);
|
||||||
rcu_read_lock();
|
if (!test_and_clear_bit(XPRT_SOCK_NOSPACE, &transport->sock_state))
|
||||||
wq = rcu_dereference(sk->sk_wq);
|
return;
|
||||||
if (!wq || test_and_clear_bit(SOCKWQ_ASYNC_NOSPACE, &wq->flags) == 0)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
xs_run_error_worker(transport, XPRT_SOCK_WAKE_WRITE);
|
xs_run_error_worker(transport, XPRT_SOCK_WAKE_WRITE);
|
||||||
sk->sk_write_pending--;
|
sk->sk_write_pending--;
|
||||||
out:
|
|
||||||
rcu_read_unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1857,7 +1846,6 @@ static int xs_local_finish_connecting(struct rpc_xprt *xprt,
|
||||||
sk->sk_user_data = xprt;
|
sk->sk_user_data = xprt;
|
||||||
sk->sk_data_ready = xs_data_ready;
|
sk->sk_data_ready = xs_data_ready;
|
||||||
sk->sk_write_space = xs_udp_write_space;
|
sk->sk_write_space = xs_udp_write_space;
|
||||||
sock_set_flag(sk, SOCK_FASYNC);
|
|
||||||
sk->sk_error_report = xs_error_report;
|
sk->sk_error_report = xs_error_report;
|
||||||
|
|
||||||
xprt_clear_connected(xprt);
|
xprt_clear_connected(xprt);
|
||||||
|
@ -2051,7 +2039,6 @@ 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_data_ready;
|
sk->sk_data_ready = xs_data_ready;
|
||||||
sk->sk_write_space = xs_udp_write_space;
|
sk->sk_write_space = xs_udp_write_space;
|
||||||
sock_set_flag(sk, SOCK_FASYNC);
|
|
||||||
|
|
||||||
xprt_set_connected(xprt);
|
xprt_set_connected(xprt);
|
||||||
|
|
||||||
|
@ -2218,7 +2205,6 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
|
||||||
sk->sk_data_ready = xs_data_ready;
|
sk->sk_data_ready = xs_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;
|
||||||
sock_set_flag(sk, SOCK_FASYNC);
|
|
||||||
sk->sk_error_report = xs_error_report;
|
sk->sk_error_report = xs_error_report;
|
||||||
|
|
||||||
/* socket options */
|
/* socket options */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче