aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nfsd
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/nfsd')
-rw-r--r--include/linux/nfsd/nfsd.h9
-rw-r--r--include/linux/nfsd/state.h77
-rw-r--r--include/linux/nfsd/xdr4.h19
3 files changed, 63 insertions, 42 deletions
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 2b49d676d0c..510ffdd5020 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -56,8 +56,11 @@ 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 const struct seq_operations nfs_exports_op;
61 64
62/* 65/*
63 * Function prototypes. 66 * Function prototypes.
@@ -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 57ab2ed0845..b38d1132418 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 2bacf753506..73164c2b3d2 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)