diff options
author | Chuck Lever <cel@netapp.com> | 2005-08-25 19:25:49 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-09-23 12:38:35 -0400 |
commit | 43118c29dea2b23798bd42a147015cceee7fa885 (patch) | |
tree | 4951a6777a3dc167d46c1373c02d21912b250e96 | |
parent | 808012fbb23a52ec59352445d2076d175ad4ab26 (diff) |
[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: Chuck Lever <cel@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/lockd/host.c | 3 | ||||
-rw-r--r-- | include/linux/sunrpc/xprt.h | 3 | ||||
-rw-r--r-- | net/sunrpc/xprt.c | 3 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 28 |
4 files changed, 21 insertions, 16 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 82c77df81c5f..7901f5b8092c 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
@@ -173,11 +173,10 @@ nlm_bind_host(struct nlm_host *host) | |||
173 | 173 | ||
174 | /* If we've already created an RPC client, check whether | 174 | /* If we've already created an RPC client, check whether |
175 | * RPC rebind is required | 175 | * RPC rebind is required |
176 | * Note: why keep rebinding if we're on a tcp connection? | ||
177 | */ | 176 | */ |
178 | if ((clnt = host->h_rpcclnt) != NULL) { | 177 | if ((clnt = host->h_rpcclnt) != NULL) { |
179 | xprt = clnt->cl_xprt; | 178 | xprt = clnt->cl_xprt; |
180 | if (!xprt->stream && time_after_eq(jiffies, host->h_nextrebind)) { | 179 | if (time_after_eq(jiffies, host->h_nextrebind)) { |
181 | clnt->cl_port = 0; | 180 | clnt->cl_port = 0; |
182 | host->h_nextrebind = jiffies + NLM_HOST_REBIND; | 181 | host->h_nextrebind = jiffies + NLM_HOST_REBIND; |
183 | dprintk("lockd: next rebind in %ld jiffies\n", | 182 | dprintk("lockd: next rebind in %ld jiffies\n", |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 966c456a0f6d..c9477f022efb 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -168,8 +168,7 @@ struct rpc_xprt { | |||
168 | unsigned long state; /* transport state */ | 168 | unsigned long state; /* transport state */ |
169 | unsigned char shutdown : 1, /* being shut down */ | 169 | unsigned char shutdown : 1, /* being shut down */ |
170 | nocong : 1, /* no congestion control */ | 170 | nocong : 1, /* no congestion control */ |
171 | resvport : 1, /* use a reserved port */ | 171 | resvport : 1; /* use a reserved port */ |
172 | stream : 1; /* TCP */ | ||
173 | 172 | ||
174 | /* | 173 | /* |
175 | * XID | 174 | * XID |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 31ef7dc7eed6..43fef7626442 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -630,8 +630,7 @@ void xprt_transmit(struct rpc_task *task) | |||
630 | case -ENOTCONN: | 630 | case -ENOTCONN: |
631 | return; | 631 | return; |
632 | default: | 632 | default: |
633 | if (xprt->stream) | 633 | break; |
634 | xprt_disconnect(xprt); | ||
635 | } | 634 | } |
636 | xprt_release_write(xprt, task); | 635 | xprt_release_write(xprt, task); |
637 | return; | 636 | return; |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index aaf053b1a0c4..5bb6fed3df34 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -356,6 +356,7 @@ static int xs_tcp_send_request(struct rpc_task *task) | |||
356 | default: | 356 | default: |
357 | dprintk("RPC: sendmsg returned unrecognized error %d\n", | 357 | dprintk("RPC: sendmsg returned unrecognized error %d\n", |
358 | -status); | 358 | -status); |
359 | xprt_disconnect(xprt); | ||
359 | break; | 360 | break; |
360 | } | 361 | } |
361 | 362 | ||
@@ -826,19 +827,17 @@ static void xs_tcp_write_space(struct sock *sk) | |||
826 | } | 827 | } |
827 | 828 | ||
828 | /** | 829 | /** |
829 | * xs_set_buffer_size - set send and receive limits | 830 | * xs_udp_set_buffer_size - set send and receive limits |
830 | * @xprt: generic transport | 831 | * @xprt: generic transport |
831 | * | 832 | * |
832 | * Set socket send and receive limits based on the | 833 | * Set socket send and receive limits based on the |
833 | * sndsize and rcvsize fields in the generic transport | 834 | * sndsize and rcvsize fields in the generic transport |
834 | * structure. This applies only to UDP sockets. | 835 | * structure. |
835 | */ | 836 | */ |
836 | static void xs_set_buffer_size(struct rpc_xprt *xprt) | 837 | static void xs_udp_set_buffer_size(struct rpc_xprt *xprt) |
837 | { | 838 | { |
838 | struct sock *sk = xprt->inet; | 839 | struct sock *sk = xprt->inet; |
839 | 840 | ||
840 | if (xprt->stream) | ||
841 | return; | ||
842 | if (xprt->rcvsize) { | 841 | if (xprt->rcvsize) { |
843 | sk->sk_userlocks |= SOCK_RCVBUF_LOCK; | 842 | sk->sk_userlocks |= SOCK_RCVBUF_LOCK; |
844 | sk->sk_rcvbuf = xprt->rcvsize * xprt->max_reqs * 2; | 843 | sk->sk_rcvbuf = xprt->rcvsize * xprt->max_reqs * 2; |
@@ -850,6 +849,17 @@ static void xs_set_buffer_size(struct rpc_xprt *xprt) | |||
850 | } | 849 | } |
851 | } | 850 | } |
852 | 851 | ||
852 | /** | ||
853 | * xs_tcp_set_buffer_size - set send and receive limits | ||
854 | * @xprt: generic transport | ||
855 | * | ||
856 | * Nothing to do for TCP. | ||
857 | */ | ||
858 | static void xs_tcp_set_buffer_size(struct rpc_xprt *xprt) | ||
859 | { | ||
860 | return; | ||
861 | } | ||
862 | |||
853 | static int xs_bindresvport(struct rpc_xprt *xprt, struct socket *sock) | 863 | static int xs_bindresvport(struct rpc_xprt *xprt, struct socket *sock) |
854 | { | 864 | { |
855 | struct sockaddr_in myaddr = { | 865 | struct sockaddr_in myaddr = { |
@@ -928,7 +938,7 @@ static void xs_udp_connect_worker(void *args) | |||
928 | 938 | ||
929 | write_unlock_bh(&sk->sk_callback_lock); | 939 | write_unlock_bh(&sk->sk_callback_lock); |
930 | } | 940 | } |
931 | xs_set_buffer_size(xprt); | 941 | xs_udp_set_buffer_size(xprt); |
932 | status = 0; | 942 | status = 0; |
933 | out: | 943 | out: |
934 | xprt_wake_pending_tasks(xprt, status); | 944 | xprt_wake_pending_tasks(xprt, status); |
@@ -1034,7 +1044,7 @@ static void xs_connect(struct rpc_task *task) | |||
1034 | } | 1044 | } |
1035 | 1045 | ||
1036 | static struct rpc_xprt_ops xs_udp_ops = { | 1046 | static struct rpc_xprt_ops xs_udp_ops = { |
1037 | .set_buffer_size = xs_set_buffer_size, | 1047 | .set_buffer_size = xs_udp_set_buffer_size, |
1038 | .connect = xs_connect, | 1048 | .connect = xs_connect, |
1039 | .send_request = xs_udp_send_request, | 1049 | .send_request = xs_udp_send_request, |
1040 | .close = xs_close, | 1050 | .close = xs_close, |
@@ -1042,7 +1052,7 @@ static struct rpc_xprt_ops xs_udp_ops = { | |||
1042 | }; | 1052 | }; |
1043 | 1053 | ||
1044 | static struct rpc_xprt_ops xs_tcp_ops = { | 1054 | static struct rpc_xprt_ops xs_tcp_ops = { |
1045 | .set_buffer_size = xs_set_buffer_size, | 1055 | .set_buffer_size = xs_tcp_set_buffer_size, |
1046 | .connect = xs_connect, | 1056 | .connect = xs_connect, |
1047 | .send_request = xs_tcp_send_request, | 1057 | .send_request = xs_tcp_send_request, |
1048 | .close = xs_close, | 1058 | .close = xs_close, |
@@ -1074,7 +1084,6 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to) | |||
1074 | xprt->prot = IPPROTO_UDP; | 1084 | xprt->prot = IPPROTO_UDP; |
1075 | xprt->port = XS_MAX_RESVPORT; | 1085 | xprt->port = XS_MAX_RESVPORT; |
1076 | xprt->tsh_size = 0; | 1086 | xprt->tsh_size = 0; |
1077 | xprt->stream = 0; | ||
1078 | xprt->nocong = 0; | 1087 | xprt->nocong = 0; |
1079 | xprt->cwnd = RPC_INITCWND; | 1088 | xprt->cwnd = RPC_INITCWND; |
1080 | xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; | 1089 | 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 | xprt->prot = IPPROTO_TCP; | 1124 | xprt->prot = IPPROTO_TCP; |
1116 | xprt->port = XS_MAX_RESVPORT; | 1125 | xprt->port = XS_MAX_RESVPORT; |
1117 | xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32); | 1126 | xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32); |
1118 | xprt->stream = 1; | ||
1119 | xprt->nocong = 1; | 1127 | xprt->nocong = 1; |
1120 | xprt->cwnd = RPC_MAXCWND(xprt); | 1128 | xprt->cwnd = RPC_MAXCWND(xprt); |
1121 | xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; | 1129 | xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; |