diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2006-08-22 20:06:15 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-09-22 23:24:39 -0400 |
commit | 4a68179d38874c37be2802442a71b847f5d1a2a9 (patch) | |
tree | 688b345744d182e303f96891d396a0ee1e43520a /include | |
parent | ec739ef03dc926d05051c8c5838971445504470a (diff) |
SUNRPC: Make RPC portmapper use per-transport storage
Move connection and bind state that was maintained in the rpc_clnt
structure to the rpc_xprt structure. This will allow the creation of
a clean API for plugging in different types of bind mechanisms.
This brings improvements such as the elimination of a single spin lock to
control serialization for all in-kernel RPC binding. A set of per-xprt
bitops is used to serialize tasks during RPC binding, just like it now
works for making RPC transport connections.
Test-plan:
Destructive testing (unplugging the network temporarily). Connectathon
with UDP and TCP. NFSv2/3 and NFSv4 mounting should be carefully checked.
Probably need to rig a server where certain services aren't running, or
that returns an error for some typical operation.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/sunrpc/clnt.h | 23 | ||||
-rw-r--r-- | include/linux/sunrpc/xprt.h | 14 |
2 files changed, 17 insertions, 20 deletions
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 8fe9f35eba31..00e9dbaec9c5 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -18,18 +18,6 @@ | |||
18 | #include <linux/sunrpc/timer.h> | 18 | #include <linux/sunrpc/timer.h> |
19 | #include <asm/signal.h> | 19 | #include <asm/signal.h> |
20 | 20 | ||
21 | /* | ||
22 | * This defines an RPC port mapping | ||
23 | */ | ||
24 | struct rpc_portmap { | ||
25 | __u32 pm_prog; | ||
26 | __u32 pm_vers; | ||
27 | __u32 pm_prot; | ||
28 | __u16 pm_port; | ||
29 | unsigned char pm_binding : 1; /* doing a getport() */ | ||
30 | struct rpc_wait_queue pm_bindwait; /* waiting on getport() */ | ||
31 | }; | ||
32 | |||
33 | struct rpc_inode; | 21 | struct rpc_inode; |
34 | 22 | ||
35 | /* | 23 | /* |
@@ -40,7 +28,9 @@ struct rpc_clnt { | |||
40 | atomic_t cl_users; /* number of references */ | 28 | atomic_t cl_users; /* number of references */ |
41 | struct rpc_xprt * cl_xprt; /* transport */ | 29 | struct rpc_xprt * cl_xprt; /* transport */ |
42 | struct rpc_procinfo * cl_procinfo; /* procedure info */ | 30 | struct rpc_procinfo * cl_procinfo; /* procedure info */ |
43 | u32 cl_maxproc; /* max procedure number */ | 31 | u32 cl_prog, /* RPC program number */ |
32 | cl_vers, /* RPC version number */ | ||
33 | cl_maxproc; /* max procedure number */ | ||
44 | 34 | ||
45 | char * cl_server; /* server machine name */ | 35 | char * cl_server; /* server machine name */ |
46 | char * cl_protname; /* protocol name */ | 36 | char * cl_protname; /* protocol name */ |
@@ -55,7 +45,6 @@ struct rpc_clnt { | |||
55 | cl_dead : 1;/* abandoned */ | 45 | cl_dead : 1;/* abandoned */ |
56 | 46 | ||
57 | struct rpc_rtt * cl_rtt; /* RTO estimator data */ | 47 | struct rpc_rtt * cl_rtt; /* RTO estimator data */ |
58 | struct rpc_portmap * cl_pmap; /* port mapping */ | ||
59 | 48 | ||
60 | int cl_nodelen; /* nodename length */ | 49 | int cl_nodelen; /* nodename length */ |
61 | char cl_nodename[UNX_MAXNODENAME]; | 50 | char cl_nodename[UNX_MAXNODENAME]; |
@@ -64,14 +53,8 @@ struct rpc_clnt { | |||
64 | struct dentry * cl_dentry; /* inode */ | 53 | struct dentry * cl_dentry; /* inode */ |
65 | struct rpc_clnt * cl_parent; /* Points to parent of clones */ | 54 | struct rpc_clnt * cl_parent; /* Points to parent of clones */ |
66 | struct rpc_rtt cl_rtt_default; | 55 | struct rpc_rtt cl_rtt_default; |
67 | struct rpc_portmap cl_pmap_default; | ||
68 | char cl_inline_name[32]; | 56 | char cl_inline_name[32]; |
69 | }; | 57 | }; |
70 | #define cl_timeout cl_xprt->timeout | ||
71 | #define cl_prog cl_pmap->pm_prog | ||
72 | #define cl_vers cl_pmap->pm_vers | ||
73 | #define cl_port cl_pmap->pm_port | ||
74 | #define cl_prot cl_pmap->pm_prot | ||
75 | 58 | ||
76 | /* | 59 | /* |
77 | * General RPC program info | 60 | * General RPC program info |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index a71106723d71..4ce82616873d 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -138,6 +138,7 @@ struct rpc_xprt { | |||
138 | unsigned int tsh_size; /* size of transport specific | 138 | unsigned int tsh_size; /* size of transport specific |
139 | header */ | 139 | header */ |
140 | 140 | ||
141 | struct rpc_wait_queue binding; /* requests waiting on rpcbind */ | ||
141 | struct rpc_wait_queue sending; /* requests waiting to send */ | 142 | struct rpc_wait_queue sending; /* requests waiting to send */ |
142 | struct rpc_wait_queue resend; /* requests waiting to resend */ | 143 | struct rpc_wait_queue resend; /* requests waiting to resend */ |
143 | struct rpc_wait_queue pending; /* requests in flight */ | 144 | struct rpc_wait_queue pending; /* requests in flight */ |
@@ -270,6 +271,7 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to); | |||
270 | #define XPRT_CONNECTING (2) | 271 | #define XPRT_CONNECTING (2) |
271 | #define XPRT_CLOSE_WAIT (3) | 272 | #define XPRT_CLOSE_WAIT (3) |
272 | #define XPRT_BOUND (4) | 273 | #define XPRT_BOUND (4) |
274 | #define XPRT_BINDING (5) | ||
273 | 275 | ||
274 | static inline void xprt_set_connected(struct rpc_xprt *xprt) | 276 | static inline void xprt_set_connected(struct rpc_xprt *xprt) |
275 | { | 277 | { |
@@ -328,6 +330,18 @@ static inline void xprt_clear_bound(struct rpc_xprt *xprt) | |||
328 | clear_bit(XPRT_BOUND, &xprt->state); | 330 | clear_bit(XPRT_BOUND, &xprt->state); |
329 | } | 331 | } |
330 | 332 | ||
333 | static inline void xprt_clear_binding(struct rpc_xprt *xprt) | ||
334 | { | ||
335 | smp_mb__before_clear_bit(); | ||
336 | clear_bit(XPRT_BINDING, &xprt->state); | ||
337 | smp_mb__after_clear_bit(); | ||
338 | } | ||
339 | |||
340 | static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt) | ||
341 | { | ||
342 | return test_and_set_bit(XPRT_BINDING, &xprt->state); | ||
343 | } | ||
344 | |||
331 | #endif /* __KERNEL__*/ | 345 | #endif /* __KERNEL__*/ |
332 | 346 | ||
333 | #endif /* _LINUX_SUNRPC_XPRT_H */ | 347 | #endif /* _LINUX_SUNRPC_XPRT_H */ |