Commit 43118c29 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

[PATCH] RPC: get rid of xprt->stream

 Now we can fix up the last few places that use the "xprt->stream"
 variable, and get rid of it from the rpc_xprt structure.

 Test-plan:
 Destructive testing (unplugging the network temporarily).  Connectathon
 with UDP and TCP.
Signed-off-by: default avatarChuck Lever <cel@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 808012fb
...@@ -173,11 +173,10 @@ nlm_bind_host(struct nlm_host *host) ...@@ -173,11 +173,10 @@ nlm_bind_host(struct nlm_host *host)
/* If we've already created an RPC client, check whether /* If we've already created an RPC client, check whether
* RPC rebind is required * RPC rebind is required
* Note: why keep rebinding if we're on a tcp connection?
*/ */
if ((clnt = host->h_rpcclnt) != NULL) { if ((clnt = host->h_rpcclnt) != NULL) {
xprt = clnt->cl_xprt; xprt = clnt->cl_xprt;
if (!xprt->stream && time_after_eq(jiffies, host->h_nextrebind)) { if (time_after_eq(jiffies, host->h_nextrebind)) {
clnt->cl_port = 0; clnt->cl_port = 0;
host->h_nextrebind = jiffies + NLM_HOST_REBIND; host->h_nextrebind = jiffies + NLM_HOST_REBIND;
dprintk("lockd: next rebind in %ld jiffies\n", dprintk("lockd: next rebind in %ld jiffies\n",
......
...@@ -168,8 +168,7 @@ struct rpc_xprt { ...@@ -168,8 +168,7 @@ struct rpc_xprt {
unsigned long state; /* transport state */ unsigned long state; /* transport state */
unsigned char shutdown : 1, /* being shut down */ unsigned char shutdown : 1, /* being shut down */
nocong : 1, /* no congestion control */ nocong : 1, /* no congestion control */
resvport : 1, /* use a reserved port */ resvport : 1; /* use a reserved port */
stream : 1; /* TCP */
/* /*
* XID * XID
......
...@@ -630,8 +630,7 @@ void xprt_transmit(struct rpc_task *task) ...@@ -630,8 +630,7 @@ void xprt_transmit(struct rpc_task *task)
case -ENOTCONN: case -ENOTCONN:
return; return;
default: default:
if (xprt->stream) break;
xprt_disconnect(xprt);
} }
xprt_release_write(xprt, task); xprt_release_write(xprt, task);
return; return;
......
...@@ -356,6 +356,7 @@ static int xs_tcp_send_request(struct rpc_task *task) ...@@ -356,6 +356,7 @@ static int xs_tcp_send_request(struct rpc_task *task)
default: default:
dprintk("RPC: sendmsg returned unrecognized error %d\n", dprintk("RPC: sendmsg returned unrecognized error %d\n",
-status); -status);
xprt_disconnect(xprt);
break; break;
} }
...@@ -826,19 +827,17 @@ static void xs_tcp_write_space(struct sock *sk) ...@@ -826,19 +827,17 @@ static void xs_tcp_write_space(struct sock *sk)
} }
/** /**
* xs_set_buffer_size - set send and receive limits * xs_udp_set_buffer_size - set send and receive limits
* @xprt: generic transport * @xprt: generic transport
* *
* Set socket send and receive limits based on the * Set socket send and receive limits based on the
* sndsize and rcvsize fields in the generic transport * sndsize and rcvsize fields in the generic transport
* structure. This applies only to UDP sockets. * structure.
*/ */
static void xs_set_buffer_size(struct rpc_xprt *xprt) static void xs_udp_set_buffer_size(struct rpc_xprt *xprt)
{ {
struct sock *sk = xprt->inet; struct sock *sk = xprt->inet;
if (xprt->stream)
return;
if (xprt->rcvsize) { if (xprt->rcvsize) {
sk->sk_userlocks |= SOCK_RCVBUF_LOCK; sk->sk_userlocks |= SOCK_RCVBUF_LOCK;
sk->sk_rcvbuf = xprt->rcvsize * xprt->max_reqs * 2; sk->sk_rcvbuf = xprt->rcvsize * xprt->max_reqs * 2;
...@@ -850,6 +849,17 @@ static void xs_set_buffer_size(struct rpc_xprt *xprt) ...@@ -850,6 +849,17 @@ static void xs_set_buffer_size(struct rpc_xprt *xprt)
} }
} }
/**
* xs_tcp_set_buffer_size - set send and receive limits
* @xprt: generic transport
*
* Nothing to do for TCP.
*/
static void xs_tcp_set_buffer_size(struct rpc_xprt *xprt)
{
return;
}
static int xs_bindresvport(struct rpc_xprt *xprt, struct socket *sock) static int xs_bindresvport(struct rpc_xprt *xprt, struct socket *sock)
{ {
struct sockaddr_in myaddr = { struct sockaddr_in myaddr = {
...@@ -928,7 +938,7 @@ static void xs_udp_connect_worker(void *args) ...@@ -928,7 +938,7 @@ static void xs_udp_connect_worker(void *args)
write_unlock_bh(&sk->sk_callback_lock); write_unlock_bh(&sk->sk_callback_lock);
} }
xs_set_buffer_size(xprt); xs_udp_set_buffer_size(xprt);
status = 0; status = 0;
out: out:
xprt_wake_pending_tasks(xprt, status); xprt_wake_pending_tasks(xprt, status);
...@@ -1034,7 +1044,7 @@ static void xs_connect(struct rpc_task *task) ...@@ -1034,7 +1044,7 @@ static void xs_connect(struct rpc_task *task)
} }
static struct rpc_xprt_ops xs_udp_ops = { static struct rpc_xprt_ops xs_udp_ops = {
.set_buffer_size = xs_set_buffer_size, .set_buffer_size = xs_udp_set_buffer_size,
.connect = xs_connect, .connect = xs_connect,
.send_request = xs_udp_send_request, .send_request = xs_udp_send_request,
.close = xs_close, .close = xs_close,
...@@ -1042,7 +1052,7 @@ static struct rpc_xprt_ops xs_udp_ops = { ...@@ -1042,7 +1052,7 @@ static struct rpc_xprt_ops xs_udp_ops = {
}; };
static struct rpc_xprt_ops xs_tcp_ops = { static struct rpc_xprt_ops xs_tcp_ops = {
.set_buffer_size = xs_set_buffer_size, .set_buffer_size = xs_tcp_set_buffer_size,
.connect = xs_connect, .connect = xs_connect,
.send_request = xs_tcp_send_request, .send_request = xs_tcp_send_request,
.close = xs_close, .close = xs_close,
...@@ -1074,7 +1084,6 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to) ...@@ -1074,7 +1084,6 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to)
xprt->prot = IPPROTO_UDP; xprt->prot = IPPROTO_UDP;
xprt->port = XS_MAX_RESVPORT; xprt->port = XS_MAX_RESVPORT;
xprt->tsh_size = 0; xprt->tsh_size = 0;
xprt->stream = 0;
xprt->nocong = 0; xprt->nocong = 0;
xprt->cwnd = RPC_INITCWND; xprt->cwnd = RPC_INITCWND;
xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0;
...@@ -1115,7 +1124,6 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to) ...@@ -1115,7 +1124,6 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to)
xprt->prot = IPPROTO_TCP; xprt->prot = IPPROTO_TCP;
xprt->port = XS_MAX_RESVPORT; xprt->port = XS_MAX_RESVPORT;
xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32); xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32);
xprt->stream = 1;
xprt->nocong = 1; xprt->nocong = 1;
xprt->cwnd = RPC_MAXCWND(xprt); xprt->cwnd = RPC_MAXCWND(xprt);
xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment