aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 10:54:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 10:54:33 -0400
commita87e84b5cdfacf11af4e8a85c4bca9793658536f (patch)
treef8e3cb2d339d8ed0e987d55f725e501730cdc81d /include
parent342ff1a1b558ebbdb8cbd55ab6a63eca8b2473ca (diff)
parent3c394ddaa7ea4205f933fd9b481166b2669368a9 (diff)
Merge branch 'for-2.6.32' of git://linux-nfs.org/~bfields/linux
* 'for-2.6.32' of git://linux-nfs.org/~bfields/linux: (68 commits) nfsd4: nfsv4 clients should cross mountpoints nfsd: revise 4.1 status documentation sunrpc/cache: avoid variable over-loading in cache_defer_req sunrpc/cache: use list_del_init for the list_head entries in cache_deferred_req nfsd: return success for non-NFS4 nfs4_state_start nfsd41: Refactor create_client() nfsd41: modify nfsd4.1 backchannel to use new xprt class nfsd41: Backchannel: Implement cb_recall over NFSv4.1 nfsd41: Backchannel: cb_sequence callback nfsd41: Backchannel: Setup sequence information nfsd41: Backchannel: Server backchannel RPC wait queue nfsd41: Backchannel: Add sequence arguments to callback RPC arguments nfsd41: Backchannel: callback infrastructure nfsd4: use common rpc_cred for all callbacks nfsd4: allow nfs4 state startup to fail SUNRPC: Defer the auth_gss upcall when the RPC call is asynchronous nfsd4: fix null dereference creating nfsv4 callback client nfsd4: fix whitespace in NFSPROC4_CLNT_CB_NULL definition nfsd41: sunrpc: add new xprt class for nfsv4.1 backchannel sunrpc/cache: simplify cache_fresh_locked and cache_fresh_unlocked. ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/lockd/lockd.h43
-rw-r--r--include/linux/nfs4.h2
-rw-r--r--include/linux/nfsd/nfsd.h7
-rw-r--r--include/linux/nfsd/state.h77
-rw-r--r--include/linux/nfsd/xdr4.h19
-rw-r--r--include/linux/sunrpc/auth.h4
-rw-r--r--include/linux/sunrpc/clnt.h114
-rw-r--r--include/linux/sunrpc/svc.h2
-rw-r--r--include/linux/sunrpc/svc_xprt.h1
-rw-r--r--include/linux/sunrpc/svcsock.h1
-rw-r--r--include/linux/sunrpc/xprt.h19
-rw-r--r--include/linux/sunrpc/xprtrdma.h5
-rw-r--r--include/linux/sunrpc/xprtsock.h11
13 files changed, 200 insertions, 105 deletions
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index ccf2e0dc077a..a34dea46b629 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -338,49 +338,6 @@ static inline int nlm_privileged_requester(const struct svc_rqst *rqstp)
338 } 338 }
339} 339}
340 340
341static inline int __nlm_cmp_addr4(const struct sockaddr *sap1,
342 const struct sockaddr *sap2)
343{
344 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
345 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
346 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
347}
348
349#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
350static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
351 const struct sockaddr *sap2)
352{
353 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
354 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
355 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
356}
357#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
358static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
359 const struct sockaddr *sap2)
360{
361 return 0;
362}
363#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
364
365/*
366 * Compare two host addresses
367 *
368 * Return TRUE if the addresses are the same; otherwise FALSE.
369 */
370static inline int nlm_cmp_addr(const struct sockaddr *sap1,
371 const struct sockaddr *sap2)
372{
373 if (sap1->sa_family == sap2->sa_family) {
374 switch (sap1->sa_family) {
375 case AF_INET:
376 return __nlm_cmp_addr4(sap1, sap2);
377 case AF_INET6:
378 return __nlm_cmp_addr6(sap1, sap2);
379 }
380 }
381 return 0;
382}
383
384/* 341/*
385 * Compare two NLM locks. 342 * Compare two NLM locks.
386 * When the second lock is of type F_UNLCK, this acts like a wildcard. 343 * When the second lock is of type F_UNLCK, this acts like a wildcard.
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 33b283601f62..c4c060208109 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -234,7 +234,7 @@ enum nfs_opnum4 {
234Needs to be updated if more operations are defined in future.*/ 234Needs to be updated if more operations are defined in future.*/
235 235
236#define FIRST_NFS4_OP OP_ACCESS 236#define FIRST_NFS4_OP OP_ACCESS
237#define LAST_NFS4_OP OP_RELEASE_LOCKOWNER 237#define LAST_NFS4_OP OP_RECLAIM_COMPLETE
238 238
239enum nfsstat4 { 239enum nfsstat4 {
240 NFS4_OK = 0, 240 NFS4_OK = 0,
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 2b49d676d0c9..03bbe9039104 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -56,6 +56,9 @@ extern struct svc_version nfsd_version2, nfsd_version3,
56extern u32 nfsd_supported_minorversion; 56extern u32 nfsd_supported_minorversion;
57extern struct mutex nfsd_mutex; 57extern struct mutex nfsd_mutex;
58extern struct svc_serv *nfsd_serv; 58extern struct svc_serv *nfsd_serv;
59extern spinlock_t nfsd_drc_lock;
60extern unsigned int nfsd_drc_max_mem;
61extern unsigned int nfsd_drc_mem_used;
59 62
60extern struct seq_operations nfs_exports_op; 63extern struct seq_operations nfs_exports_op;
61 64
@@ -163,7 +166,7 @@ extern int nfsd_max_blksize;
163extern unsigned int max_delegations; 166extern unsigned int max_delegations;
164int nfs4_state_init(void); 167int nfs4_state_init(void);
165void nfsd4_free_slabs(void); 168void nfsd4_free_slabs(void);
166void nfs4_state_start(void); 169int nfs4_state_start(void);
167void nfs4_state_shutdown(void); 170void nfs4_state_shutdown(void);
168time_t nfs4_lease_time(void); 171time_t nfs4_lease_time(void);
169void nfs4_reset_lease(time_t leasetime); 172void nfs4_reset_lease(time_t leasetime);
@@ -171,7 +174,7 @@ int nfs4_reset_recoverydir(char *recdir);
171#else 174#else
172static inline int nfs4_state_init(void) { return 0; } 175static inline int nfs4_state_init(void) { return 0; }
173static inline void nfsd4_free_slabs(void) { } 176static inline void nfsd4_free_slabs(void) { }
174static inline void nfs4_state_start(void) { } 177static inline int nfs4_state_start(void) { return 0; }
175static inline void nfs4_state_shutdown(void) { } 178static inline void nfs4_state_shutdown(void) { }
176static inline time_t nfs4_lease_time(void) { return 0; } 179static inline time_t nfs4_lease_time(void) { return 0; }
177static inline void nfs4_reset_lease(time_t leasetime) { } 180static inline void nfs4_reset_lease(time_t leasetime) { }
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index 57ab2ed08459..b38d11324189 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -60,6 +60,12 @@ typedef struct {
60#define si_stateownerid si_opaque.so_stateownerid 60#define si_stateownerid si_opaque.so_stateownerid
61#define si_fileid si_opaque.so_fileid 61#define si_fileid si_opaque.so_fileid
62 62
63struct nfsd4_cb_sequence {
64 /* args/res */
65 u32 cbs_minorversion;
66 struct nfs4_client *cbs_clp;
67};
68
63struct nfs4_delegation { 69struct nfs4_delegation {
64 struct list_head dl_perfile; 70 struct list_head dl_perfile;
65 struct list_head dl_perclnt; 71 struct list_head dl_perclnt;
@@ -81,38 +87,35 @@ struct nfs4_delegation {
81/* client delegation callback info */ 87/* client delegation callback info */
82struct nfs4_cb_conn { 88struct nfs4_cb_conn {
83 /* SETCLIENTID info */ 89 /* SETCLIENTID info */
84 u32 cb_addr; 90 struct sockaddr_storage cb_addr;
85 unsigned short cb_port; 91 size_t cb_addrlen;
86 u32 cb_prog; 92 u32 cb_prog;
87 u32 cb_minorversion; 93 u32 cb_minorversion;
88 u32 cb_ident; /* minorversion 0 only */ 94 u32 cb_ident; /* minorversion 0 only */
89 /* RPC client info */ 95 /* RPC client info */
90 atomic_t cb_set; /* successful CB_NULL call */ 96 atomic_t cb_set; /* successful CB_NULL call */
91 struct rpc_clnt * cb_client; 97 struct rpc_clnt * cb_client;
92 struct rpc_cred * cb_cred;
93}; 98};
94 99
95/* Maximum number of slots per session. 128 is useful for long haul TCP */ 100/* Maximum number of slots per session. 160 is useful for long haul TCP */
96#define NFSD_MAX_SLOTS_PER_SESSION 128 101#define NFSD_MAX_SLOTS_PER_SESSION 160
97/* Maximum number of pages per slot cache entry */
98#define NFSD_PAGES_PER_SLOT 1
99/* Maximum number of operations per session compound */ 102/* Maximum number of operations per session compound */
100#define NFSD_MAX_OPS_PER_COMPOUND 16 103#define NFSD_MAX_OPS_PER_COMPOUND 16
101 104/* Maximum session per slot cache size */
102struct nfsd4_cache_entry { 105#define NFSD_SLOT_CACHE_SIZE 1024
103 __be32 ce_status; 106/* Maximum number of NFSD_SLOT_CACHE_SIZE slots per session */
104 struct kvec ce_datav; /* encoded NFSv4.1 data in rq_res.head[0] */ 107#define NFSD_CACHE_SIZE_SLOTS_PER_SESSION 32
105 struct page *ce_respages[NFSD_PAGES_PER_SLOT + 1]; 108#define NFSD_MAX_MEM_PER_SESSION \
106 int ce_cachethis; 109 (NFSD_CACHE_SIZE_SLOTS_PER_SESSION * NFSD_SLOT_CACHE_SIZE)
107 short ce_resused;
108 int ce_opcnt;
109 int ce_rpchdrlen;
110};
111 110
112struct nfsd4_slot { 111struct nfsd4_slot {
113 bool sl_inuse; 112 bool sl_inuse;
114 u32 sl_seqid; 113 bool sl_cachethis;
115 struct nfsd4_cache_entry sl_cache_entry; 114 u16 sl_opcnt;
115 u32 sl_seqid;
116 __be32 sl_status;
117 u32 sl_datalen;
118 char sl_data[];
116}; 119};
117 120
118struct nfsd4_channel_attrs { 121struct nfsd4_channel_attrs {
@@ -126,6 +129,25 @@ struct nfsd4_channel_attrs {
126 u32 rdma_attrs; 129 u32 rdma_attrs;
127}; 130};
128 131
132struct nfsd4_create_session {
133 clientid_t clientid;
134 struct nfs4_sessionid sessionid;
135 u32 seqid;
136 u32 flags;
137 struct nfsd4_channel_attrs fore_channel;
138 struct nfsd4_channel_attrs back_channel;
139 u32 callback_prog;
140 u32 uid;
141 u32 gid;
142};
143
144/* The single slot clientid cache structure */
145struct nfsd4_clid_slot {
146 u32 sl_seqid;
147 __be32 sl_status;
148 struct nfsd4_create_session sl_cr_ses;
149};
150
129struct nfsd4_session { 151struct nfsd4_session {
130 struct kref se_ref; 152 struct kref se_ref;
131 struct list_head se_hash; /* hash by sessionid */ 153 struct list_head se_hash; /* hash by sessionid */
@@ -135,7 +157,7 @@ struct nfsd4_session {
135 struct nfs4_sessionid se_sessionid; 157 struct nfs4_sessionid se_sessionid;
136 struct nfsd4_channel_attrs se_fchannel; 158 struct nfsd4_channel_attrs se_fchannel;
137 struct nfsd4_channel_attrs se_bchannel; 159 struct nfsd4_channel_attrs se_bchannel;
138 struct nfsd4_slot se_slots[]; /* forward channel slots */ 160 struct nfsd4_slot *se_slots[]; /* forward channel slots */
139}; 161};
140 162
141static inline void 163static inline void
@@ -180,7 +202,7 @@ struct nfs4_client {
180 char cl_recdir[HEXDIR_LEN]; /* recovery dir */ 202 char cl_recdir[HEXDIR_LEN]; /* recovery dir */
181 nfs4_verifier cl_verifier; /* generated by client */ 203 nfs4_verifier cl_verifier; /* generated by client */
182 time_t cl_time; /* time of last lease renewal */ 204 time_t cl_time; /* time of last lease renewal */
183 __be32 cl_addr; /* client ipaddress */ 205 struct sockaddr_storage cl_addr; /* client ipaddress */
184 u32 cl_flavor; /* setclientid pseudoflavor */ 206 u32 cl_flavor; /* setclientid pseudoflavor */
185 char *cl_principal; /* setclientid principal name */ 207 char *cl_principal; /* setclientid principal name */
186 struct svc_cred cl_cred; /* setclientid principal */ 208 struct svc_cred cl_cred; /* setclientid principal */
@@ -192,9 +214,17 @@ struct nfs4_client {
192 214
193 /* for nfs41 */ 215 /* for nfs41 */
194 struct list_head cl_sessions; 216 struct list_head cl_sessions;
195 struct nfsd4_slot cl_slot; /* create_session slot */ 217 struct nfsd4_clid_slot cl_cs_slot; /* create_session slot */
196 u32 cl_exchange_flags; 218 u32 cl_exchange_flags;
197 struct nfs4_sessionid cl_sessionid; 219 struct nfs4_sessionid cl_sessionid;
220
221 /* for nfs41 callbacks */
222 /* We currently support a single back channel with a single slot */
223 unsigned long cl_cb_slot_busy;
224 u32 cl_cb_seq_nr;
225 struct svc_xprt *cl_cb_xprt; /* 4.1 callback transport */
226 struct rpc_wait_queue cl_cb_waitq; /* backchannel callers may */
227 /* wait here for slots */
198}; 228};
199 229
200/* struct nfs4_client_reset 230/* struct nfs4_client_reset
@@ -345,6 +375,7 @@ extern int nfs4_in_grace(void);
345extern __be32 nfs4_check_open_reclaim(clientid_t *clid); 375extern __be32 nfs4_check_open_reclaim(clientid_t *clid);
346extern void put_nfs4_client(struct nfs4_client *clp); 376extern void put_nfs4_client(struct nfs4_client *clp);
347extern void nfs4_free_stateowner(struct kref *kref); 377extern void nfs4_free_stateowner(struct kref *kref);
378extern int set_callback_cred(void);
348extern void nfsd4_probe_callback(struct nfs4_client *clp); 379extern void nfsd4_probe_callback(struct nfs4_client *clp);
349extern void nfsd4_cb_recall(struct nfs4_delegation *dp); 380extern void nfsd4_cb_recall(struct nfs4_delegation *dp);
350extern void nfs4_put_delegation(struct nfs4_delegation *dp); 381extern void nfs4_put_delegation(struct nfs4_delegation *dp);
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index 2bacf7535069..73164c2b3d29 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -51,7 +51,7 @@ struct nfsd4_compound_state {
51 /* For sessions DRC */ 51 /* For sessions DRC */
52 struct nfsd4_session *session; 52 struct nfsd4_session *session;
53 struct nfsd4_slot *slot; 53 struct nfsd4_slot *slot;
54 __be32 *statp; 54 __be32 *datap;
55 size_t iovlen; 55 size_t iovlen;
56 u32 minorversion; 56 u32 minorversion;
57 u32 status; 57 u32 status;
@@ -366,18 +366,6 @@ struct nfsd4_exchange_id {
366 int spa_how; 366 int spa_how;
367}; 367};
368 368
369struct nfsd4_create_session {
370 clientid_t clientid;
371 struct nfs4_sessionid sessionid;
372 u32 seqid;
373 u32 flags;
374 struct nfsd4_channel_attrs fore_channel;
375 struct nfsd4_channel_attrs back_channel;
376 u32 callback_prog;
377 u32 uid;
378 u32 gid;
379};
380
381struct nfsd4_sequence { 369struct nfsd4_sequence {
382 struct nfs4_sessionid sessionid; /* request/response */ 370 struct nfs4_sessionid sessionid; /* request/response */
383 u32 seqid; /* request/response */ 371 u32 seqid; /* request/response */
@@ -479,13 +467,12 @@ struct nfsd4_compoundres {
479static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp) 467static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp)
480{ 468{
481 struct nfsd4_compoundargs *args = resp->rqstp->rq_argp; 469 struct nfsd4_compoundargs *args = resp->rqstp->rq_argp;
482 return args->opcnt == 1; 470 return resp->opcnt == 1 && args->ops[0].opnum == OP_SEQUENCE;
483} 471}
484 472
485static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp) 473static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)
486{ 474{
487 return !resp->cstate.slot->sl_cache_entry.ce_cachethis || 475 return !resp->cstate.slot->sl_cachethis || nfsd4_is_solo_sequence(resp);
488 nfsd4_is_solo_sequence(resp);
489} 476}
490 477
491#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) 478#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 3f632182d8eb..996df4dac7d4 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -111,7 +111,7 @@ struct rpc_credops {
111 void (*crdestroy)(struct rpc_cred *); 111 void (*crdestroy)(struct rpc_cred *);
112 112
113 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); 113 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int);
114 void (*crbind)(struct rpc_task *, struct rpc_cred *); 114 void (*crbind)(struct rpc_task *, struct rpc_cred *, int);
115 __be32 * (*crmarshal)(struct rpc_task *, __be32 *); 115 __be32 * (*crmarshal)(struct rpc_task *, __be32 *);
116 int (*crrefresh)(struct rpc_task *); 116 int (*crrefresh)(struct rpc_task *);
117 __be32 * (*crvalidate)(struct rpc_task *, __be32 *); 117 __be32 * (*crvalidate)(struct rpc_task *, __be32 *);
@@ -140,7 +140,7 @@ struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *
140void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); 140void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *);
141struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); 141struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int);
142void rpcauth_bindcred(struct rpc_task *, struct rpc_cred *, int); 142void rpcauth_bindcred(struct rpc_task *, struct rpc_cred *, int);
143void rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *); 143void rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *, int);
144void put_rpccred(struct rpc_cred *); 144void put_rpccred(struct rpc_cred *);
145void rpcauth_unbindcred(struct rpc_task *); 145void rpcauth_unbindcred(struct rpc_task *);
146__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *); 146__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index ab3f6e90caa5..8ed9642a5a76 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -22,6 +22,7 @@
22#include <linux/sunrpc/timer.h> 22#include <linux/sunrpc/timer.h>
23#include <asm/signal.h> 23#include <asm/signal.h>
24#include <linux/path.h> 24#include <linux/path.h>
25#include <net/ipv6.h>
25 26
26struct rpc_inode; 27struct rpc_inode;
27 28
@@ -113,6 +114,7 @@ struct rpc_create_args {
113 rpc_authflavor_t authflavor; 114 rpc_authflavor_t authflavor;
114 unsigned long flags; 115 unsigned long flags;
115 char *client_name; 116 char *client_name;
117 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
116}; 118};
117 119
118/* Values for "flags" field */ 120/* Values for "flags" field */
@@ -188,5 +190,117 @@ static inline void rpc_set_port(struct sockaddr *sap,
188#define IPV6_SCOPE_DELIMITER '%' 190#define IPV6_SCOPE_DELIMITER '%'
189#define IPV6_SCOPE_ID_LEN sizeof("%nnnnnnnnnn") 191#define IPV6_SCOPE_ID_LEN sizeof("%nnnnnnnnnn")
190 192
193static inline bool __rpc_cmp_addr4(const struct sockaddr *sap1,
194 const struct sockaddr *sap2)
195{
196 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
197 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
198
199 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
200}
201
202static inline bool __rpc_copy_addr4(struct sockaddr *dst,
203 const struct sockaddr *src)
204{
205 const struct sockaddr_in *ssin = (struct sockaddr_in *) src;
206 struct sockaddr_in *dsin = (struct sockaddr_in *) dst;
207
208 dsin->sin_family = ssin->sin_family;
209 dsin->sin_addr.s_addr = ssin->sin_addr.s_addr;
210 return true;
211}
212
213#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
214static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
215 const struct sockaddr *sap2)
216{
217 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
218 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
219 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
220}
221
222static inline bool __rpc_copy_addr6(struct sockaddr *dst,
223 const struct sockaddr *src)
224{
225 const struct sockaddr_in6 *ssin6 = (const struct sockaddr_in6 *) src;
226 struct sockaddr_in6 *dsin6 = (struct sockaddr_in6 *) dst;
227
228 dsin6->sin6_family = ssin6->sin6_family;
229 ipv6_addr_copy(&dsin6->sin6_addr, &ssin6->sin6_addr);
230 return true;
231}
232#else /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
233static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
234 const struct sockaddr *sap2)
235{
236 return false;
237}
238
239static inline bool __rpc_copy_addr6(struct sockaddr *dst,
240 const struct sockaddr *src)
241{
242 return false;
243}
244#endif /* !(CONFIG_IPV6 || CONFIG_IPV6_MODULE) */
245
246/**
247 * rpc_cmp_addr - compare the address portion of two sockaddrs.
248 * @sap1: first sockaddr
249 * @sap2: second sockaddr
250 *
251 * Just compares the family and address portion. Ignores port, scope, etc.
252 * Returns true if the addrs are equal, false if they aren't.
253 */
254static inline bool rpc_cmp_addr(const struct sockaddr *sap1,
255 const struct sockaddr *sap2)
256{
257 if (sap1->sa_family == sap2->sa_family) {
258 switch (sap1->sa_family) {
259 case AF_INET:
260 return __rpc_cmp_addr4(sap1, sap2);
261 case AF_INET6:
262 return __rpc_cmp_addr6(sap1, sap2);
263 }
264 }
265 return false;
266}
267
268/**
269 * rpc_copy_addr - copy the address portion of one sockaddr to another
270 * @dst: destination sockaddr
271 * @src: source sockaddr
272 *
273 * Just copies the address portion and family. Ignores port, scope, etc.
274 * Caller is responsible for making certain that dst is large enough to hold
275 * the address in src. Returns true if address family is supported. Returns
276 * false otherwise.
277 */
278static inline bool rpc_copy_addr(struct sockaddr *dst,
279 const struct sockaddr *src)
280{
281 switch (src->sa_family) {
282 case AF_INET:
283 return __rpc_copy_addr4(dst, src);
284 case AF_INET6:
285 return __rpc_copy_addr6(dst, src);
286 }
287 return false;
288}
289
290/**
291 * rpc_get_scope_id - return scopeid for a given sockaddr
292 * @sa: sockaddr to get scopeid from
293 *
294 * Returns the value of the sin6_scope_id for AF_INET6 addrs, or 0 if
295 * not an AF_INET6 address.
296 */
297static inline u32 rpc_get_scope_id(const struct sockaddr *sa)
298{
299 if (sa->sa_family != AF_INET6)
300 return 0;
301
302 return ((struct sockaddr_in6 *) sa)->sin6_scope_id;
303}
304
191#endif /* __KERNEL__ */ 305#endif /* __KERNEL__ */
192#endif /* _LINUX_SUNRPC_CLNT_H */ 306#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index ea8009695c69..52e8cb0a7569 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -94,8 +94,6 @@ struct svc_serv {
94 struct module * sv_module; /* optional module to count when 94 struct module * sv_module; /* optional module to count when
95 * adding threads */ 95 * adding threads */
96 svc_thread_fn sv_function; /* main function for threads */ 96 svc_thread_fn sv_function; /* main function for threads */
97 unsigned int sv_drc_max_pages; /* Total pages for DRC */
98 unsigned int sv_drc_pages_used;/* DRC pages used */
99#if defined(CONFIG_NFS_V4_1) 97#if defined(CONFIG_NFS_V4_1)
100 struct list_head sv_cb_list; /* queue for callback requests 98 struct list_head sv_cb_list; /* queue for callback requests
101 * that arrive over the same 99 * that arrive over the same
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 2223ae0b5ed5..5f4e18b3ce73 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -65,6 +65,7 @@ struct svc_xprt {
65 size_t xpt_locallen; /* length of address */ 65 size_t xpt_locallen; /* length of address */
66 struct sockaddr_storage xpt_remote; /* remote peer's address */ 66 struct sockaddr_storage xpt_remote; /* remote peer's address */
67 size_t xpt_remotelen; /* length of address */ 67 size_t xpt_remotelen; /* length of address */
68 struct rpc_wait_queue xpt_bc_pending; /* backchannel wait queue */
68}; 69};
69 70
70int svc_reg_xprt_class(struct svc_xprt_class *); 71int svc_reg_xprt_class(struct svc_xprt_class *);
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 04dba23c59f2..1b353a76c304 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -28,6 +28,7 @@ struct svc_sock {
28 /* private TCP part */ 28 /* private TCP part */
29 u32 sk_reclen; /* length of record */ 29 u32 sk_reclen; /* length of record */
30 u32 sk_tcplen; /* current read length */ 30 u32 sk_tcplen; /* current read length */
31 struct rpc_xprt *sk_bc_xprt; /* NFSv4.1 backchannel xprt */
31}; 32};
32 33
33/* 34/*
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index c090df442572..6f9457a75b8f 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -124,6 +124,23 @@ struct rpc_xprt_ops {
124 void (*print_stats)(struct rpc_xprt *xprt, struct seq_file *seq); 124 void (*print_stats)(struct rpc_xprt *xprt, struct seq_file *seq);
125}; 125};
126 126
127/*
128 * RPC transport identifiers
129 *
130 * To preserve compatibility with the historical use of raw IP protocol
131 * id's for transport selection, UDP and TCP identifiers are specified
132 * with the previous values. No such restriction exists for new transports,
133 * except that they may not collide with these values (17 and 6,
134 * respectively).
135 */
136#define XPRT_TRANSPORT_BC (1 << 31)
137enum xprt_transports {
138 XPRT_TRANSPORT_UDP = IPPROTO_UDP,
139 XPRT_TRANSPORT_TCP = IPPROTO_TCP,
140 XPRT_TRANSPORT_BC_TCP = IPPROTO_TCP | XPRT_TRANSPORT_BC,
141 XPRT_TRANSPORT_RDMA = 256
142};
143
127struct rpc_xprt { 144struct rpc_xprt {
128 struct kref kref; /* Reference count */ 145 struct kref kref; /* Reference count */
129 struct rpc_xprt_ops * ops; /* transport methods */ 146 struct rpc_xprt_ops * ops; /* transport methods */
@@ -179,6 +196,7 @@ struct rpc_xprt {
179 spinlock_t reserve_lock; /* lock slot table */ 196 spinlock_t reserve_lock; /* lock slot table */
180 u32 xid; /* Next XID value to use */ 197 u32 xid; /* Next XID value to use */
181 struct rpc_task * snd_task; /* Task blocked in send */ 198 struct rpc_task * snd_task; /* Task blocked in send */
199 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
182#if defined(CONFIG_NFS_V4_1) 200#if defined(CONFIG_NFS_V4_1)
183 struct svc_serv *bc_serv; /* The RPC service which will */ 201 struct svc_serv *bc_serv; /* The RPC service which will */
184 /* process the callback */ 202 /* process the callback */
@@ -231,6 +249,7 @@ struct xprt_create {
231 struct sockaddr * srcaddr; /* optional local address */ 249 struct sockaddr * srcaddr; /* optional local address */
232 struct sockaddr * dstaddr; /* remote peer address */ 250 struct sockaddr * dstaddr; /* remote peer address */
233 size_t addrlen; 251 size_t addrlen;
252 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
234}; 253};
235 254
236struct xprt_class { 255struct xprt_class {
diff --git a/include/linux/sunrpc/xprtrdma.h b/include/linux/sunrpc/xprtrdma.h
index 54a379c9e8eb..c2f04e1ae159 100644
--- a/include/linux/sunrpc/xprtrdma.h
+++ b/include/linux/sunrpc/xprtrdma.h
@@ -41,11 +41,6 @@
41#define _LINUX_SUNRPC_XPRTRDMA_H 41#define _LINUX_SUNRPC_XPRTRDMA_H
42 42
43/* 43/*
44 * RPC transport identifier for RDMA
45 */
46#define XPRT_TRANSPORT_RDMA 256
47
48/*
49 * rpcbind (v3+) RDMA netid. 44 * rpcbind (v3+) RDMA netid.
50 */ 45 */
51#define RPCBIND_NETID_RDMA "rdma" 46#define RPCBIND_NETID_RDMA "rdma"
diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h
index c2a46c45c8f7..3f14a02e9cc0 100644
--- a/include/linux/sunrpc/xprtsock.h
+++ b/include/linux/sunrpc/xprtsock.h
@@ -13,17 +13,6 @@ int init_socket_xprt(void);
13void cleanup_socket_xprt(void); 13void cleanup_socket_xprt(void);
14 14
15/* 15/*
16 * RPC transport identifiers for UDP, TCP
17 *
18 * To preserve compatibility with the historical use of raw IP protocol
19 * id's for transport selection, these are specified with the previous
20 * values. No such restriction exists for new transports, except that
21 * they may not collide with these values (17 and 6, respectively).
22 */
23#define XPRT_TRANSPORT_UDP IPPROTO_UDP
24#define XPRT_TRANSPORT_TCP IPPROTO_TCP
25
26/*
27 * RPC slot table sizes for UDP, TCP transports 16 * RPC slot table sizes for UDP, TCP transports
28 */ 17 */
29extern unsigned int xprt_udp_slot_table_entries; 18extern unsigned int xprt_udp_slot_table_entries;