diff options
Diffstat (limited to 'include/linux/nfsd')
-rw-r--r-- | include/linux/nfsd/cache.h | 8 | ||||
-rw-r--r-- | include/linux/nfsd/nfsd.h | 225 | ||||
-rw-r--r-- | include/linux/nfsd/nfsfh.h | 7 | ||||
-rw-r--r-- | include/linux/nfsd/state.h | 84 | ||||
-rw-r--r-- | include/linux/nfsd/stats.h | 9 | ||||
-rw-r--r-- | include/linux/nfsd/xdr4.h | 129 |
6 files changed, 359 insertions, 103 deletions
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h index 04b355c801d8..5bccaab81056 100644 --- a/include/linux/nfsd/cache.h +++ b/include/linux/nfsd/cache.h | |||
@@ -76,4 +76,12 @@ void nfsd_reply_cache_shutdown(void); | |||
76 | int nfsd_cache_lookup(struct svc_rqst *, int); | 76 | int nfsd_cache_lookup(struct svc_rqst *, int); |
77 | void nfsd_cache_update(struct svc_rqst *, int, __be32 *); | 77 | void nfsd_cache_update(struct svc_rqst *, int, __be32 *); |
78 | 78 | ||
79 | #ifdef CONFIG_NFSD_V4 | ||
80 | void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp); | ||
81 | #else /* CONFIG_NFSD_V4 */ | ||
82 | static inline void nfsd4_set_statp(struct svc_rqst *rqstp, __be32 *statp) | ||
83 | { | ||
84 | } | ||
85 | #endif /* CONFIG_NFSD_V4 */ | ||
86 | |||
79 | #endif /* NFSCACHE_H */ | 87 | #endif /* NFSCACHE_H */ |
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index e19f45991b2e..2b49d676d0c9 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h | |||
@@ -23,7 +23,7 @@ | |||
23 | /* | 23 | /* |
24 | * nfsd version | 24 | * nfsd version |
25 | */ | 25 | */ |
26 | #define NFSD_SUPPORTED_MINOR_VERSION 0 | 26 | #define NFSD_SUPPORTED_MINOR_VERSION 1 |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * Flags for nfsd_permission | 29 | * Flags for nfsd_permission |
@@ -53,6 +53,7 @@ typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); | |||
53 | extern struct svc_program nfsd_program; | 53 | extern struct svc_program nfsd_program; |
54 | extern struct svc_version nfsd_version2, nfsd_version3, | 54 | extern struct svc_version nfsd_version2, nfsd_version3, |
55 | nfsd_version4; | 55 | nfsd_version4; |
56 | extern u32 nfsd_supported_minorversion; | ||
56 | extern struct mutex nfsd_mutex; | 57 | extern struct mutex nfsd_mutex; |
57 | extern struct svc_serv *nfsd_serv; | 58 | extern struct svc_serv *nfsd_serv; |
58 | 59 | ||
@@ -105,7 +106,7 @@ void nfsd_close(struct file *); | |||
105 | __be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *, | 106 | __be32 nfsd_read(struct svc_rqst *, struct svc_fh *, struct file *, |
106 | loff_t, struct kvec *, int, unsigned long *); | 107 | loff_t, struct kvec *, int, unsigned long *); |
107 | __be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, | 108 | __be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, |
108 | loff_t, struct kvec *,int, unsigned long, int *); | 109 | loff_t, struct kvec *,int, unsigned long *, int *); |
109 | __be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *, | 110 | __be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *, |
110 | char *, int *); | 111 | char *, int *); |
111 | __be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *, | 112 | __be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *, |
@@ -149,6 +150,7 @@ int nfsd_set_posix_acl(struct svc_fh *, int, struct posix_acl *); | |||
149 | 150 | ||
150 | enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL }; | 151 | enum vers_op {NFSD_SET, NFSD_CLEAR, NFSD_TEST, NFSD_AVAIL }; |
151 | int nfsd_vers(int vers, enum vers_op change); | 152 | int nfsd_vers(int vers, enum vers_op change); |
153 | int nfsd_minorversion(u32 minorversion, enum vers_op change); | ||
152 | void nfsd_reset_versions(void); | 154 | void nfsd_reset_versions(void); |
153 | int nfsd_create_serv(void); | 155 | int nfsd_create_serv(void); |
154 | 156 | ||
@@ -186,78 +188,119 @@ void nfsd_lockd_shutdown(void); | |||
186 | /* | 188 | /* |
187 | * These macros provide pre-xdr'ed values for faster operation. | 189 | * These macros provide pre-xdr'ed values for faster operation. |
188 | */ | 190 | */ |
189 | #define nfs_ok __constant_htonl(NFS_OK) | 191 | #define nfs_ok cpu_to_be32(NFS_OK) |
190 | #define nfserr_perm __constant_htonl(NFSERR_PERM) | 192 | #define nfserr_perm cpu_to_be32(NFSERR_PERM) |
191 | #define nfserr_noent __constant_htonl(NFSERR_NOENT) | 193 | #define nfserr_noent cpu_to_be32(NFSERR_NOENT) |
192 | #define nfserr_io __constant_htonl(NFSERR_IO) | 194 | #define nfserr_io cpu_to_be32(NFSERR_IO) |
193 | #define nfserr_nxio __constant_htonl(NFSERR_NXIO) | 195 | #define nfserr_nxio cpu_to_be32(NFSERR_NXIO) |
194 | #define nfserr_eagain __constant_htonl(NFSERR_EAGAIN) | 196 | #define nfserr_eagain cpu_to_be32(NFSERR_EAGAIN) |
195 | #define nfserr_acces __constant_htonl(NFSERR_ACCES) | 197 | #define nfserr_acces cpu_to_be32(NFSERR_ACCES) |
196 | #define nfserr_exist __constant_htonl(NFSERR_EXIST) | 198 | #define nfserr_exist cpu_to_be32(NFSERR_EXIST) |
197 | #define nfserr_xdev __constant_htonl(NFSERR_XDEV) | 199 | #define nfserr_xdev cpu_to_be32(NFSERR_XDEV) |
198 | #define nfserr_nodev __constant_htonl(NFSERR_NODEV) | 200 | #define nfserr_nodev cpu_to_be32(NFSERR_NODEV) |
199 | #define nfserr_notdir __constant_htonl(NFSERR_NOTDIR) | 201 | #define nfserr_notdir cpu_to_be32(NFSERR_NOTDIR) |
200 | #define nfserr_isdir __constant_htonl(NFSERR_ISDIR) | 202 | #define nfserr_isdir cpu_to_be32(NFSERR_ISDIR) |
201 | #define nfserr_inval __constant_htonl(NFSERR_INVAL) | 203 | #define nfserr_inval cpu_to_be32(NFSERR_INVAL) |
202 | #define nfserr_fbig __constant_htonl(NFSERR_FBIG) | 204 | #define nfserr_fbig cpu_to_be32(NFSERR_FBIG) |
203 | #define nfserr_nospc __constant_htonl(NFSERR_NOSPC) | 205 | #define nfserr_nospc cpu_to_be32(NFSERR_NOSPC) |
204 | #define nfserr_rofs __constant_htonl(NFSERR_ROFS) | 206 | #define nfserr_rofs cpu_to_be32(NFSERR_ROFS) |
205 | #define nfserr_mlink __constant_htonl(NFSERR_MLINK) | 207 | #define nfserr_mlink cpu_to_be32(NFSERR_MLINK) |
206 | #define nfserr_opnotsupp __constant_htonl(NFSERR_OPNOTSUPP) | 208 | #define nfserr_opnotsupp cpu_to_be32(NFSERR_OPNOTSUPP) |
207 | #define nfserr_nametoolong __constant_htonl(NFSERR_NAMETOOLONG) | 209 | #define nfserr_nametoolong cpu_to_be32(NFSERR_NAMETOOLONG) |
208 | #define nfserr_notempty __constant_htonl(NFSERR_NOTEMPTY) | 210 | #define nfserr_notempty cpu_to_be32(NFSERR_NOTEMPTY) |
209 | #define nfserr_dquot __constant_htonl(NFSERR_DQUOT) | 211 | #define nfserr_dquot cpu_to_be32(NFSERR_DQUOT) |
210 | #define nfserr_stale __constant_htonl(NFSERR_STALE) | 212 | #define nfserr_stale cpu_to_be32(NFSERR_STALE) |
211 | #define nfserr_remote __constant_htonl(NFSERR_REMOTE) | 213 | #define nfserr_remote cpu_to_be32(NFSERR_REMOTE) |
212 | #define nfserr_wflush __constant_htonl(NFSERR_WFLUSH) | 214 | #define nfserr_wflush cpu_to_be32(NFSERR_WFLUSH) |
213 | #define nfserr_badhandle __constant_htonl(NFSERR_BADHANDLE) | 215 | #define nfserr_badhandle cpu_to_be32(NFSERR_BADHANDLE) |
214 | #define nfserr_notsync __constant_htonl(NFSERR_NOT_SYNC) | 216 | #define nfserr_notsync cpu_to_be32(NFSERR_NOT_SYNC) |
215 | #define nfserr_badcookie __constant_htonl(NFSERR_BAD_COOKIE) | 217 | #define nfserr_badcookie cpu_to_be32(NFSERR_BAD_COOKIE) |
216 | #define nfserr_notsupp __constant_htonl(NFSERR_NOTSUPP) | 218 | #define nfserr_notsupp cpu_to_be32(NFSERR_NOTSUPP) |
217 | #define nfserr_toosmall __constant_htonl(NFSERR_TOOSMALL) | 219 | #define nfserr_toosmall cpu_to_be32(NFSERR_TOOSMALL) |
218 | #define nfserr_serverfault __constant_htonl(NFSERR_SERVERFAULT) | 220 | #define nfserr_serverfault cpu_to_be32(NFSERR_SERVERFAULT) |
219 | #define nfserr_badtype __constant_htonl(NFSERR_BADTYPE) | 221 | #define nfserr_badtype cpu_to_be32(NFSERR_BADTYPE) |
220 | #define nfserr_jukebox __constant_htonl(NFSERR_JUKEBOX) | 222 | #define nfserr_jukebox cpu_to_be32(NFSERR_JUKEBOX) |
221 | #define nfserr_denied __constant_htonl(NFSERR_DENIED) | 223 | #define nfserr_denied cpu_to_be32(NFSERR_DENIED) |
222 | #define nfserr_deadlock __constant_htonl(NFSERR_DEADLOCK) | 224 | #define nfserr_deadlock cpu_to_be32(NFSERR_DEADLOCK) |
223 | #define nfserr_expired __constant_htonl(NFSERR_EXPIRED) | 225 | #define nfserr_expired cpu_to_be32(NFSERR_EXPIRED) |
224 | #define nfserr_bad_cookie __constant_htonl(NFSERR_BAD_COOKIE) | 226 | #define nfserr_bad_cookie cpu_to_be32(NFSERR_BAD_COOKIE) |
225 | #define nfserr_same __constant_htonl(NFSERR_SAME) | 227 | #define nfserr_same cpu_to_be32(NFSERR_SAME) |
226 | #define nfserr_clid_inuse __constant_htonl(NFSERR_CLID_INUSE) | 228 | #define nfserr_clid_inuse cpu_to_be32(NFSERR_CLID_INUSE) |
227 | #define nfserr_stale_clientid __constant_htonl(NFSERR_STALE_CLIENTID) | 229 | #define nfserr_stale_clientid cpu_to_be32(NFSERR_STALE_CLIENTID) |
228 | #define nfserr_resource __constant_htonl(NFSERR_RESOURCE) | 230 | #define nfserr_resource cpu_to_be32(NFSERR_RESOURCE) |
229 | #define nfserr_moved __constant_htonl(NFSERR_MOVED) | 231 | #define nfserr_moved cpu_to_be32(NFSERR_MOVED) |
230 | #define nfserr_nofilehandle __constant_htonl(NFSERR_NOFILEHANDLE) | 232 | #define nfserr_nofilehandle cpu_to_be32(NFSERR_NOFILEHANDLE) |
231 | #define nfserr_minor_vers_mismatch __constant_htonl(NFSERR_MINOR_VERS_MISMATCH) | 233 | #define nfserr_minor_vers_mismatch cpu_to_be32(NFSERR_MINOR_VERS_MISMATCH) |
232 | #define nfserr_share_denied __constant_htonl(NFSERR_SHARE_DENIED) | 234 | #define nfserr_share_denied cpu_to_be32(NFSERR_SHARE_DENIED) |
233 | #define nfserr_stale_stateid __constant_htonl(NFSERR_STALE_STATEID) | 235 | #define nfserr_stale_stateid cpu_to_be32(NFSERR_STALE_STATEID) |
234 | #define nfserr_old_stateid __constant_htonl(NFSERR_OLD_STATEID) | 236 | #define nfserr_old_stateid cpu_to_be32(NFSERR_OLD_STATEID) |
235 | #define nfserr_bad_stateid __constant_htonl(NFSERR_BAD_STATEID) | 237 | #define nfserr_bad_stateid cpu_to_be32(NFSERR_BAD_STATEID) |
236 | #define nfserr_bad_seqid __constant_htonl(NFSERR_BAD_SEQID) | 238 | #define nfserr_bad_seqid cpu_to_be32(NFSERR_BAD_SEQID) |
237 | #define nfserr_symlink __constant_htonl(NFSERR_SYMLINK) | 239 | #define nfserr_symlink cpu_to_be32(NFSERR_SYMLINK) |
238 | #define nfserr_not_same __constant_htonl(NFSERR_NOT_SAME) | 240 | #define nfserr_not_same cpu_to_be32(NFSERR_NOT_SAME) |
239 | #define nfserr_restorefh __constant_htonl(NFSERR_RESTOREFH) | 241 | #define nfserr_restorefh cpu_to_be32(NFSERR_RESTOREFH) |
240 | #define nfserr_attrnotsupp __constant_htonl(NFSERR_ATTRNOTSUPP) | 242 | #define nfserr_attrnotsupp cpu_to_be32(NFSERR_ATTRNOTSUPP) |
241 | #define nfserr_bad_xdr __constant_htonl(NFSERR_BAD_XDR) | 243 | #define nfserr_bad_xdr cpu_to_be32(NFSERR_BAD_XDR) |
242 | #define nfserr_openmode __constant_htonl(NFSERR_OPENMODE) | 244 | #define nfserr_openmode cpu_to_be32(NFSERR_OPENMODE) |
243 | #define nfserr_locks_held __constant_htonl(NFSERR_LOCKS_HELD) | 245 | #define nfserr_locks_held cpu_to_be32(NFSERR_LOCKS_HELD) |
244 | #define nfserr_op_illegal __constant_htonl(NFSERR_OP_ILLEGAL) | 246 | #define nfserr_op_illegal cpu_to_be32(NFSERR_OP_ILLEGAL) |
245 | #define nfserr_grace __constant_htonl(NFSERR_GRACE) | 247 | #define nfserr_grace cpu_to_be32(NFSERR_GRACE) |
246 | #define nfserr_no_grace __constant_htonl(NFSERR_NO_GRACE) | 248 | #define nfserr_no_grace cpu_to_be32(NFSERR_NO_GRACE) |
247 | #define nfserr_reclaim_bad __constant_htonl(NFSERR_RECLAIM_BAD) | 249 | #define nfserr_reclaim_bad cpu_to_be32(NFSERR_RECLAIM_BAD) |
248 | #define nfserr_badname __constant_htonl(NFSERR_BADNAME) | 250 | #define nfserr_badname cpu_to_be32(NFSERR_BADNAME) |
249 | #define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN) | 251 | #define nfserr_cb_path_down cpu_to_be32(NFSERR_CB_PATH_DOWN) |
250 | #define nfserr_locked __constant_htonl(NFSERR_LOCKED) | 252 | #define nfserr_locked cpu_to_be32(NFSERR_LOCKED) |
251 | #define nfserr_wrongsec __constant_htonl(NFSERR_WRONGSEC) | 253 | #define nfserr_wrongsec cpu_to_be32(NFSERR_WRONGSEC) |
252 | #define nfserr_replay_me __constant_htonl(NFSERR_REPLAY_ME) | 254 | #define nfserr_badiomode cpu_to_be32(NFS4ERR_BADIOMODE) |
255 | #define nfserr_badlayout cpu_to_be32(NFS4ERR_BADLAYOUT) | ||
256 | #define nfserr_bad_session_digest cpu_to_be32(NFS4ERR_BAD_SESSION_DIGEST) | ||
257 | #define nfserr_badsession cpu_to_be32(NFS4ERR_BADSESSION) | ||
258 | #define nfserr_badslot cpu_to_be32(NFS4ERR_BADSLOT) | ||
259 | #define nfserr_complete_already cpu_to_be32(NFS4ERR_COMPLETE_ALREADY) | ||
260 | #define nfserr_conn_not_bound_to_session cpu_to_be32(NFS4ERR_CONN_NOT_BOUND_TO_SESSION) | ||
261 | #define nfserr_deleg_already_wanted cpu_to_be32(NFS4ERR_DELEG_ALREADY_WANTED) | ||
262 | #define nfserr_back_chan_busy cpu_to_be32(NFS4ERR_BACK_CHAN_BUSY) | ||
263 | #define nfserr_layouttrylater cpu_to_be32(NFS4ERR_LAYOUTTRYLATER) | ||
264 | #define nfserr_layoutunavailable cpu_to_be32(NFS4ERR_LAYOUTUNAVAILABLE) | ||
265 | #define nfserr_nomatching_layout cpu_to_be32(NFS4ERR_NOMATCHING_LAYOUT) | ||
266 | #define nfserr_recallconflict cpu_to_be32(NFS4ERR_RECALLCONFLICT) | ||
267 | #define nfserr_unknown_layouttype cpu_to_be32(NFS4ERR_UNKNOWN_LAYOUTTYPE) | ||
268 | #define nfserr_seq_misordered cpu_to_be32(NFS4ERR_SEQ_MISORDERED) | ||
269 | #define nfserr_sequence_pos cpu_to_be32(NFS4ERR_SEQUENCE_POS) | ||
270 | #define nfserr_req_too_big cpu_to_be32(NFS4ERR_REQ_TOO_BIG) | ||
271 | #define nfserr_rep_too_big cpu_to_be32(NFS4ERR_REP_TOO_BIG) | ||
272 | #define nfserr_rep_too_big_to_cache cpu_to_be32(NFS4ERR_REP_TOO_BIG_TO_CACHE) | ||
273 | #define nfserr_retry_uncached_rep cpu_to_be32(NFS4ERR_RETRY_UNCACHED_REP) | ||
274 | #define nfserr_unsafe_compound cpu_to_be32(NFS4ERR_UNSAFE_COMPOUND) | ||
275 | #define nfserr_too_many_ops cpu_to_be32(NFS4ERR_TOO_MANY_OPS) | ||
276 | #define nfserr_op_not_in_session cpu_to_be32(NFS4ERR_OP_NOT_IN_SESSION) | ||
277 | #define nfserr_hash_alg_unsupp cpu_to_be32(NFS4ERR_HASH_ALG_UNSUPP) | ||
278 | #define nfserr_clientid_busy cpu_to_be32(NFS4ERR_CLIENTID_BUSY) | ||
279 | #define nfserr_pnfs_io_hole cpu_to_be32(NFS4ERR_PNFS_IO_HOLE) | ||
280 | #define nfserr_seq_false_retry cpu_to_be32(NFS4ERR_SEQ_FALSE_RETRY) | ||
281 | #define nfserr_bad_high_slot cpu_to_be32(NFS4ERR_BAD_HIGH_SLOT) | ||
282 | #define nfserr_deadsession cpu_to_be32(NFS4ERR_DEADSESSION) | ||
283 | #define nfserr_encr_alg_unsupp cpu_to_be32(NFS4ERR_ENCR_ALG_UNSUPP) | ||
284 | #define nfserr_pnfs_no_layout cpu_to_be32(NFS4ERR_PNFS_NO_LAYOUT) | ||
285 | #define nfserr_not_only_op cpu_to_be32(NFS4ERR_NOT_ONLY_OP) | ||
286 | #define nfserr_wrong_cred cpu_to_be32(NFS4ERR_WRONG_CRED) | ||
287 | #define nfserr_wrong_type cpu_to_be32(NFS4ERR_WRONG_TYPE) | ||
288 | #define nfserr_dirdeleg_unavail cpu_to_be32(NFS4ERR_DIRDELEG_UNAVAIL) | ||
289 | #define nfserr_reject_deleg cpu_to_be32(NFS4ERR_REJECT_DELEG) | ||
290 | #define nfserr_returnconflict cpu_to_be32(NFS4ERR_RETURNCONFLICT) | ||
291 | #define nfserr_deleg_revoked cpu_to_be32(NFS4ERR_DELEG_REVOKED) | ||
253 | 292 | ||
254 | /* error codes for internal use */ | 293 | /* error codes for internal use */ |
255 | /* if a request fails due to kmalloc failure, it gets dropped. | 294 | /* if a request fails due to kmalloc failure, it gets dropped. |
256 | * Client should resend eventually | 295 | * Client should resend eventually |
257 | */ | 296 | */ |
258 | #define nfserr_dropit __constant_htonl(30000) | 297 | #define nfserr_dropit cpu_to_be32(30000) |
259 | /* end-of-file indicator in readdir */ | 298 | /* end-of-file indicator in readdir */ |
260 | #define nfserr_eof __constant_htonl(30001) | 299 | #define nfserr_eof cpu_to_be32(30001) |
300 | /* replay detected */ | ||
301 | #define nfserr_replay_me cpu_to_be32(11001) | ||
302 | /* nfs41 replay detected */ | ||
303 | #define nfserr_replay_cache cpu_to_be32(11002) | ||
261 | 304 | ||
262 | /* Check for dir entries '.' and '..' */ | 305 | /* Check for dir entries '.' and '..' */ |
263 | #define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.')) | 306 | #define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.')) |
@@ -300,7 +343,7 @@ extern struct timeval nfssvc_boot; | |||
300 | * TIME_BACKUP (unlikely to be supported any time soon) | 343 | * TIME_BACKUP (unlikely to be supported any time soon) |
301 | * TIME_CREATE (unlikely to be supported any time soon) | 344 | * TIME_CREATE (unlikely to be supported any time soon) |
302 | */ | 345 | */ |
303 | #define NFSD_SUPPORTED_ATTRS_WORD0 \ | 346 | #define NFSD4_SUPPORTED_ATTRS_WORD0 \ |
304 | (FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_TYPE | FATTR4_WORD0_FH_EXPIRE_TYPE \ | 347 | (FATTR4_WORD0_SUPPORTED_ATTRS | FATTR4_WORD0_TYPE | FATTR4_WORD0_FH_EXPIRE_TYPE \ |
305 | | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_LINK_SUPPORT \ | 348 | | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE | FATTR4_WORD0_LINK_SUPPORT \ |
306 | | FATTR4_WORD0_SYMLINK_SUPPORT | FATTR4_WORD0_NAMED_ATTR | FATTR4_WORD0_FSID \ | 349 | | FATTR4_WORD0_SYMLINK_SUPPORT | FATTR4_WORD0_NAMED_ATTR | FATTR4_WORD0_FSID \ |
@@ -312,7 +355,7 @@ extern struct timeval nfssvc_boot; | |||
312 | | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \ | 355 | | FATTR4_WORD0_MAXFILESIZE | FATTR4_WORD0_MAXLINK | FATTR4_WORD0_MAXNAME \ |
313 | | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL) | 356 | | FATTR4_WORD0_MAXREAD | FATTR4_WORD0_MAXWRITE | FATTR4_WORD0_ACL) |
314 | 357 | ||
315 | #define NFSD_SUPPORTED_ATTRS_WORD1 \ | 358 | #define NFSD4_SUPPORTED_ATTRS_WORD1 \ |
316 | (FATTR4_WORD1_MODE | FATTR4_WORD1_NO_TRUNC | FATTR4_WORD1_NUMLINKS \ | 359 | (FATTR4_WORD1_MODE | FATTR4_WORD1_NO_TRUNC | FATTR4_WORD1_NUMLINKS \ |
317 | | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \ | 360 | | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP | FATTR4_WORD1_RAWDEV \ |
318 | | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \ | 361 | | FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | FATTR4_WORD1_SPACE_TOTAL \ |
@@ -320,6 +363,35 @@ extern struct timeval nfssvc_boot; | |||
320 | | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \ | 363 | | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \ |
321 | | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID) | 364 | | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID) |
322 | 365 | ||
366 | #define NFSD4_SUPPORTED_ATTRS_WORD2 0 | ||
367 | |||
368 | #define NFSD4_1_SUPPORTED_ATTRS_WORD0 \ | ||
369 | NFSD4_SUPPORTED_ATTRS_WORD0 | ||
370 | |||
371 | #define NFSD4_1_SUPPORTED_ATTRS_WORD1 \ | ||
372 | NFSD4_SUPPORTED_ATTRS_WORD1 | ||
373 | |||
374 | #define NFSD4_1_SUPPORTED_ATTRS_WORD2 \ | ||
375 | (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT) | ||
376 | |||
377 | static inline u32 nfsd_suppattrs0(u32 minorversion) | ||
378 | { | ||
379 | return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD0 | ||
380 | : NFSD4_SUPPORTED_ATTRS_WORD0; | ||
381 | } | ||
382 | |||
383 | static inline u32 nfsd_suppattrs1(u32 minorversion) | ||
384 | { | ||
385 | return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD1 | ||
386 | : NFSD4_SUPPORTED_ATTRS_WORD1; | ||
387 | } | ||
388 | |||
389 | static inline u32 nfsd_suppattrs2(u32 minorversion) | ||
390 | { | ||
391 | return minorversion ? NFSD4_1_SUPPORTED_ATTRS_WORD2 | ||
392 | : NFSD4_SUPPORTED_ATTRS_WORD2; | ||
393 | } | ||
394 | |||
323 | /* These will return ERR_INVAL if specified in GETATTR or READDIR. */ | 395 | /* These will return ERR_INVAL if specified in GETATTR or READDIR. */ |
324 | #define NFSD_WRITEONLY_ATTRS_WORD1 \ | 396 | #define NFSD_WRITEONLY_ATTRS_WORD1 \ |
325 | (FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) | 397 | (FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) |
@@ -330,6 +402,19 @@ extern struct timeval nfssvc_boot; | |||
330 | #define NFSD_WRITEABLE_ATTRS_WORD1 \ | 402 | #define NFSD_WRITEABLE_ATTRS_WORD1 \ |
331 | (FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ | 403 | (FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ |
332 | | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) | 404 | | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) |
405 | #define NFSD_WRITEABLE_ATTRS_WORD2 0 | ||
406 | |||
407 | #define NFSD_SUPPATTR_EXCLCREAT_WORD0 \ | ||
408 | NFSD_WRITEABLE_ATTRS_WORD0 | ||
409 | /* | ||
410 | * we currently store the exclusive create verifier in the v_{a,m}time | ||
411 | * attributes so the client can't set these at create time using EXCLUSIVE4_1 | ||
412 | */ | ||
413 | #define NFSD_SUPPATTR_EXCLCREAT_WORD1 \ | ||
414 | (NFSD_WRITEABLE_ATTRS_WORD1 & \ | ||
415 | ~(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)) | ||
416 | #define NFSD_SUPPATTR_EXCLCREAT_WORD2 \ | ||
417 | NFSD_WRITEABLE_ATTRS_WORD2 | ||
333 | 418 | ||
334 | #endif /* CONFIG_NFSD_V4 */ | 419 | #endif /* CONFIG_NFSD_V4 */ |
335 | 420 | ||
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h index fa317f6c154b..afa19016c4a8 100644 --- a/include/linux/nfsd/nfsfh.h +++ b/include/linux/nfsd/nfsfh.h | |||
@@ -269,6 +269,13 @@ fh_copy(struct svc_fh *dst, struct svc_fh *src) | |||
269 | return dst; | 269 | return dst; |
270 | } | 270 | } |
271 | 271 | ||
272 | static inline void | ||
273 | fh_copy_shallow(struct knfsd_fh *dst, struct knfsd_fh *src) | ||
274 | { | ||
275 | dst->fh_size = src->fh_size; | ||
276 | memcpy(&dst->fh_base, &src->fh_base, src->fh_size); | ||
277 | } | ||
278 | |||
272 | static __inline__ struct svc_fh * | 279 | static __inline__ struct svc_fh * |
273 | fh_init(struct svc_fh *fhp, int maxsize) | 280 | fh_init(struct svc_fh *fhp, int maxsize) |
274 | { | 281 | { |
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h index 128298c0362d..4d61c873feed 100644 --- a/include/linux/nfsd/state.h +++ b/include/linux/nfsd/state.h | |||
@@ -66,8 +66,7 @@ struct nfs4_cb_recall { | |||
66 | u32 cbr_ident; | 66 | u32 cbr_ident; |
67 | int cbr_trunc; | 67 | int cbr_trunc; |
68 | stateid_t cbr_stateid; | 68 | stateid_t cbr_stateid; |
69 | u32 cbr_fhlen; | 69 | struct knfsd_fh cbr_fh; |
70 | char cbr_fhval[NFS4_FHSIZE]; | ||
71 | struct nfs4_delegation *cbr_dp; | 70 | struct nfs4_delegation *cbr_dp; |
72 | }; | 71 | }; |
73 | 72 | ||
@@ -86,8 +85,7 @@ struct nfs4_delegation { | |||
86 | }; | 85 | }; |
87 | 86 | ||
88 | #define dl_stateid dl_recall.cbr_stateid | 87 | #define dl_stateid dl_recall.cbr_stateid |
89 | #define dl_fhlen dl_recall.cbr_fhlen | 88 | #define dl_fh dl_recall.cbr_fh |
90 | #define dl_fhval dl_recall.cbr_fhval | ||
91 | 89 | ||
92 | /* client delegation callback info */ | 90 | /* client delegation callback info */ |
93 | struct nfs4_callback { | 91 | struct nfs4_callback { |
@@ -101,6 +99,64 @@ struct nfs4_callback { | |||
101 | struct rpc_clnt * cb_client; | 99 | struct rpc_clnt * cb_client; |
102 | }; | 100 | }; |
103 | 101 | ||
102 | /* Maximum number of slots per session. 128 is useful for long haul TCP */ | ||
103 | #define NFSD_MAX_SLOTS_PER_SESSION 128 | ||
104 | /* Maximum number of pages per slot cache entry */ | ||
105 | #define NFSD_PAGES_PER_SLOT 1 | ||
106 | /* Maximum number of operations per session compound */ | ||
107 | #define NFSD_MAX_OPS_PER_COMPOUND 16 | ||
108 | |||
109 | struct nfsd4_cache_entry { | ||
110 | __be32 ce_status; | ||
111 | struct kvec ce_datav; /* encoded NFSv4.1 data in rq_res.head[0] */ | ||
112 | struct page *ce_respages[NFSD_PAGES_PER_SLOT + 1]; | ||
113 | int ce_cachethis; | ||
114 | short ce_resused; | ||
115 | int ce_opcnt; | ||
116 | int ce_rpchdrlen; | ||
117 | }; | ||
118 | |||
119 | struct nfsd4_slot { | ||
120 | bool sl_inuse; | ||
121 | u32 sl_seqid; | ||
122 | struct nfsd4_cache_entry sl_cache_entry; | ||
123 | }; | ||
124 | |||
125 | struct nfsd4_session { | ||
126 | struct kref se_ref; | ||
127 | struct list_head se_hash; /* hash by sessionid */ | ||
128 | struct list_head se_perclnt; | ||
129 | u32 se_flags; | ||
130 | struct nfs4_client *se_client; /* for expire_client */ | ||
131 | struct nfs4_sessionid se_sessionid; | ||
132 | u32 se_fmaxreq_sz; | ||
133 | u32 se_fmaxresp_sz; | ||
134 | u32 se_fmaxresp_cached; | ||
135 | u32 se_fmaxops; | ||
136 | u32 se_fnumslots; | ||
137 | struct nfsd4_slot se_slots[]; /* forward channel slots */ | ||
138 | }; | ||
139 | |||
140 | static inline void | ||
141 | nfsd4_put_session(struct nfsd4_session *ses) | ||
142 | { | ||
143 | extern void free_session(struct kref *kref); | ||
144 | kref_put(&ses->se_ref, free_session); | ||
145 | } | ||
146 | |||
147 | static inline void | ||
148 | nfsd4_get_session(struct nfsd4_session *ses) | ||
149 | { | ||
150 | kref_get(&ses->se_ref); | ||
151 | } | ||
152 | |||
153 | /* formatted contents of nfs4_sessionid */ | ||
154 | struct nfsd4_sessionid { | ||
155 | clientid_t clientid; | ||
156 | u32 sequence; | ||
157 | u32 reserved; | ||
158 | }; | ||
159 | |||
104 | #define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */ | 160 | #define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */ |
105 | 161 | ||
106 | /* | 162 | /* |
@@ -132,6 +188,12 @@ struct nfs4_client { | |||
132 | struct nfs4_callback cl_callback; /* callback info */ | 188 | struct nfs4_callback cl_callback; /* callback info */ |
133 | atomic_t cl_count; /* ref count */ | 189 | atomic_t cl_count; /* ref count */ |
134 | u32 cl_firststate; /* recovery dir creation */ | 190 | u32 cl_firststate; /* recovery dir creation */ |
191 | |||
192 | /* for nfs41 */ | ||
193 | struct list_head cl_sessions; | ||
194 | struct nfsd4_slot cl_slot; /* create_session slot */ | ||
195 | u32 cl_exchange_flags; | ||
196 | struct nfs4_sessionid cl_sessionid; | ||
135 | }; | 197 | }; |
136 | 198 | ||
137 | /* struct nfs4_client_reset | 199 | /* struct nfs4_client_reset |
@@ -168,8 +230,7 @@ struct nfs4_replay { | |||
168 | unsigned int rp_buflen; | 230 | unsigned int rp_buflen; |
169 | char *rp_buf; | 231 | char *rp_buf; |
170 | unsigned intrp_allocated; | 232 | unsigned intrp_allocated; |
171 | int rp_openfh_len; | 233 | struct knfsd_fh rp_openfh; |
172 | char rp_openfh[NFS4_FHSIZE]; | ||
173 | char rp_ibuf[NFSD4_REPLAY_ISIZE]; | 234 | char rp_ibuf[NFSD4_REPLAY_ISIZE]; |
174 | }; | 235 | }; |
175 | 236 | ||
@@ -217,7 +278,7 @@ struct nfs4_stateowner { | |||
217 | * share_acces, share_deny on the file. | 278 | * share_acces, share_deny on the file. |
218 | */ | 279 | */ |
219 | struct nfs4_file { | 280 | struct nfs4_file { |
220 | struct kref fi_ref; | 281 | atomic_t fi_ref; |
221 | struct list_head fi_hash; /* hash by "struct inode *" */ | 282 | struct list_head fi_hash; /* hash by "struct inode *" */ |
222 | struct list_head fi_stateids; | 283 | struct list_head fi_stateids; |
223 | struct list_head fi_delegations; | 284 | struct list_head fi_delegations; |
@@ -259,14 +320,13 @@ struct nfs4_stateid { | |||
259 | }; | 320 | }; |
260 | 321 | ||
261 | /* flags for preprocess_seqid_op() */ | 322 | /* flags for preprocess_seqid_op() */ |
262 | #define CHECK_FH 0x00000001 | 323 | #define HAS_SESSION 0x00000001 |
263 | #define CONFIRM 0x00000002 | 324 | #define CONFIRM 0x00000002 |
264 | #define OPEN_STATE 0x00000004 | 325 | #define OPEN_STATE 0x00000004 |
265 | #define LOCK_STATE 0x00000008 | 326 | #define LOCK_STATE 0x00000008 |
266 | #define RD_STATE 0x00000010 | 327 | #define RD_STATE 0x00000010 |
267 | #define WR_STATE 0x00000020 | 328 | #define WR_STATE 0x00000020 |
268 | #define CLOSE_STATE 0x00000040 | 329 | #define CLOSE_STATE 0x00000040 |
269 | #define DELEG_RET 0x00000080 | ||
270 | 330 | ||
271 | #define seqid_mutating_err(err) \ | 331 | #define seqid_mutating_err(err) \ |
272 | (((err) != nfserr_stale_clientid) && \ | 332 | (((err) != nfserr_stale_clientid) && \ |
@@ -274,7 +334,9 @@ struct nfs4_stateid { | |||
274 | ((err) != nfserr_stale_stateid) && \ | 334 | ((err) != nfserr_stale_stateid) && \ |
275 | ((err) != nfserr_bad_stateid)) | 335 | ((err) != nfserr_bad_stateid)) |
276 | 336 | ||
277 | extern __be32 nfs4_preprocess_stateid_op(struct svc_fh *current_fh, | 337 | struct nfsd4_compound_state; |
338 | |||
339 | extern __be32 nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | ||
278 | stateid_t *stateid, int flags, struct file **filp); | 340 | stateid_t *stateid, int flags, struct file **filp); |
279 | extern void nfs4_lock_state(void); | 341 | extern void nfs4_lock_state(void); |
280 | extern void nfs4_unlock_state(void); | 342 | extern void nfs4_unlock_state(void); |
@@ -290,7 +352,7 @@ extern void nfsd4_init_recdir(char *recdir_name); | |||
290 | extern int nfsd4_recdir_load(void); | 352 | extern int nfsd4_recdir_load(void); |
291 | extern void nfsd4_shutdown_recdir(void); | 353 | extern void nfsd4_shutdown_recdir(void); |
292 | extern int nfs4_client_to_reclaim(const char *name); | 354 | extern int nfs4_client_to_reclaim(const char *name); |
293 | extern int nfs4_has_reclaimed_state(const char *name); | 355 | extern int nfs4_has_reclaimed_state(const char *name, bool use_exchange_id); |
294 | extern void nfsd4_recdir_purge_old(void); | 356 | extern void nfsd4_recdir_purge_old(void); |
295 | extern int nfsd4_create_clid_dir(struct nfs4_client *clp); | 357 | extern int nfsd4_create_clid_dir(struct nfs4_client *clp); |
296 | extern void nfsd4_remove_clid_dir(struct nfs4_client *clp); | 358 | extern void nfsd4_remove_clid_dir(struct nfs4_client *clp); |
diff --git a/include/linux/nfsd/stats.h b/include/linux/nfsd/stats.h index 7678cfbe9960..2693ef647df6 100644 --- a/include/linux/nfsd/stats.h +++ b/include/linux/nfsd/stats.h | |||
@@ -11,6 +11,11 @@ | |||
11 | 11 | ||
12 | #include <linux/nfs4.h> | 12 | #include <linux/nfs4.h> |
13 | 13 | ||
14 | /* thread usage wraps very million seconds (approx one fortnight) */ | ||
15 | #define NFSD_USAGE_WRAP (HZ*1000000) | ||
16 | |||
17 | #ifdef __KERNEL__ | ||
18 | |||
14 | struct nfsd_stats { | 19 | struct nfsd_stats { |
15 | unsigned int rchits; /* repcache hits */ | 20 | unsigned int rchits; /* repcache hits */ |
16 | unsigned int rcmisses; /* repcache hits */ | 21 | unsigned int rcmisses; /* repcache hits */ |
@@ -35,10 +40,6 @@ struct nfsd_stats { | |||
35 | 40 | ||
36 | }; | 41 | }; |
37 | 42 | ||
38 | /* thread usage wraps very million seconds (approx one fortnight) */ | ||
39 | #define NFSD_USAGE_WRAP (HZ*1000000) | ||
40 | |||
41 | #ifdef __KERNEL__ | ||
42 | 43 | ||
43 | extern struct nfsd_stats nfsdstats; | 44 | extern struct nfsd_stats nfsdstats; |
44 | extern struct svc_stat nfsd_svcstats; | 45 | extern struct svc_stat nfsd_svcstats; |
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h index 27bd3e38ec5a..f80d6013fdc3 100644 --- a/include/linux/nfsd/xdr4.h +++ b/include/linux/nfsd/xdr4.h | |||
@@ -45,10 +45,22 @@ | |||
45 | #define XDR_LEN(n) (((n) + 3) & ~3) | 45 | #define XDR_LEN(n) (((n) + 3) & ~3) |
46 | 46 | ||
47 | struct nfsd4_compound_state { | 47 | struct nfsd4_compound_state { |
48 | struct svc_fh current_fh; | 48 | struct svc_fh current_fh; |
49 | struct svc_fh save_fh; | 49 | struct svc_fh save_fh; |
50 | struct nfs4_stateowner *replay_owner; | 50 | struct nfs4_stateowner *replay_owner; |
51 | }; | 51 | /* For sessions DRC */ |
52 | struct nfsd4_session *session; | ||
53 | struct nfsd4_slot *slot; | ||
54 | __be32 *statp; | ||
55 | size_t iovlen; | ||
56 | u32 minorversion; | ||
57 | u32 status; | ||
58 | }; | ||
59 | |||
60 | static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs) | ||
61 | { | ||
62 | return cs->slot != NULL; | ||
63 | } | ||
52 | 64 | ||
53 | struct nfsd4_change_info { | 65 | struct nfsd4_change_info { |
54 | u32 atomic; | 66 | u32 atomic; |
@@ -90,7 +102,7 @@ struct nfsd4_create { | |||
90 | u32 specdata2; | 102 | u32 specdata2; |
91 | } dev; /* NF4BLK, NF4CHR */ | 103 | } dev; /* NF4BLK, NF4CHR */ |
92 | } u; | 104 | } u; |
93 | u32 cr_bmval[2]; /* request */ | 105 | u32 cr_bmval[3]; /* request */ |
94 | struct iattr cr_iattr; /* request */ | 106 | struct iattr cr_iattr; /* request */ |
95 | struct nfsd4_change_info cr_cinfo; /* response */ | 107 | struct nfsd4_change_info cr_cinfo; /* response */ |
96 | struct nfs4_acl *cr_acl; | 108 | struct nfs4_acl *cr_acl; |
@@ -105,7 +117,7 @@ struct nfsd4_delegreturn { | |||
105 | }; | 117 | }; |
106 | 118 | ||
107 | struct nfsd4_getattr { | 119 | struct nfsd4_getattr { |
108 | u32 ga_bmval[2]; /* request */ | 120 | u32 ga_bmval[3]; /* request */ |
109 | struct svc_fh *ga_fhp; /* response */ | 121 | struct svc_fh *ga_fhp; /* response */ |
110 | }; | 122 | }; |
111 | 123 | ||
@@ -206,11 +218,9 @@ struct nfsd4_open { | |||
206 | stateid_t op_delegate_stateid; /* request - response */ | 218 | stateid_t op_delegate_stateid; /* request - response */ |
207 | u32 op_create; /* request */ | 219 | u32 op_create; /* request */ |
208 | u32 op_createmode; /* request */ | 220 | u32 op_createmode; /* request */ |
209 | u32 op_bmval[2]; /* request */ | 221 | u32 op_bmval[3]; /* request */ |
210 | union { /* request */ | 222 | struct iattr iattr; /* UNCHECKED4, GUARDED4, EXCLUSIVE4_1 */ |
211 | struct iattr iattr; /* UNCHECKED4,GUARDED4 */ | 223 | nfs4_verifier verf; /* EXCLUSIVE4 */ |
212 | nfs4_verifier verf; /* EXCLUSIVE4 */ | ||
213 | } u; | ||
214 | clientid_t op_clientid; /* request */ | 224 | clientid_t op_clientid; /* request */ |
215 | struct xdr_netobj op_owner; /* request */ | 225 | struct xdr_netobj op_owner; /* request */ |
216 | u32 op_seqid; /* request */ | 226 | u32 op_seqid; /* request */ |
@@ -224,8 +234,8 @@ struct nfsd4_open { | |||
224 | struct nfs4_stateowner *op_stateowner; /* used during processing */ | 234 | struct nfs4_stateowner *op_stateowner; /* used during processing */ |
225 | struct nfs4_acl *op_acl; | 235 | struct nfs4_acl *op_acl; |
226 | }; | 236 | }; |
227 | #define op_iattr u.iattr | 237 | #define op_iattr iattr |
228 | #define op_verf u.verf | 238 | #define op_verf verf |
229 | 239 | ||
230 | struct nfsd4_open_confirm { | 240 | struct nfsd4_open_confirm { |
231 | stateid_t oc_req_stateid /* request */; | 241 | stateid_t oc_req_stateid /* request */; |
@@ -259,7 +269,7 @@ struct nfsd4_readdir { | |||
259 | nfs4_verifier rd_verf; /* request */ | 269 | nfs4_verifier rd_verf; /* request */ |
260 | u32 rd_dircount; /* request */ | 270 | u32 rd_dircount; /* request */ |
261 | u32 rd_maxcount; /* request */ | 271 | u32 rd_maxcount; /* request */ |
262 | u32 rd_bmval[2]; /* request */ | 272 | u32 rd_bmval[3]; /* request */ |
263 | struct svc_rqst *rd_rqstp; /* response */ | 273 | struct svc_rqst *rd_rqstp; /* response */ |
264 | struct svc_fh * rd_fhp; /* response */ | 274 | struct svc_fh * rd_fhp; /* response */ |
265 | 275 | ||
@@ -301,7 +311,7 @@ struct nfsd4_secinfo { | |||
301 | 311 | ||
302 | struct nfsd4_setattr { | 312 | struct nfsd4_setattr { |
303 | stateid_t sa_stateid; /* request */ | 313 | stateid_t sa_stateid; /* request */ |
304 | u32 sa_bmval[2]; /* request */ | 314 | u32 sa_bmval[3]; /* request */ |
305 | struct iattr sa_iattr; /* request */ | 315 | struct iattr sa_iattr; /* request */ |
306 | struct nfs4_acl *sa_acl; | 316 | struct nfs4_acl *sa_acl; |
307 | }; | 317 | }; |
@@ -327,7 +337,7 @@ struct nfsd4_setclientid_confirm { | |||
327 | 337 | ||
328 | /* also used for NVERIFY */ | 338 | /* also used for NVERIFY */ |
329 | struct nfsd4_verify { | 339 | struct nfsd4_verify { |
330 | u32 ve_bmval[2]; /* request */ | 340 | u32 ve_bmval[3]; /* request */ |
331 | u32 ve_attrlen; /* request */ | 341 | u32 ve_attrlen; /* request */ |
332 | char * ve_attrval; /* request */ | 342 | char * ve_attrval; /* request */ |
333 | }; | 343 | }; |
@@ -344,6 +354,54 @@ struct nfsd4_write { | |||
344 | nfs4_verifier wr_verifier; /* response */ | 354 | nfs4_verifier wr_verifier; /* response */ |
345 | }; | 355 | }; |
346 | 356 | ||
357 | struct nfsd4_exchange_id { | ||
358 | nfs4_verifier verifier; | ||
359 | struct xdr_netobj clname; | ||
360 | u32 flags; | ||
361 | clientid_t clientid; | ||
362 | u32 seqid; | ||
363 | int spa_how; | ||
364 | }; | ||
365 | |||
366 | struct nfsd4_channel_attrs { | ||
367 | u32 headerpadsz; | ||
368 | u32 maxreq_sz; | ||
369 | u32 maxresp_sz; | ||
370 | u32 maxresp_cached; | ||
371 | u32 maxops; | ||
372 | u32 maxreqs; | ||
373 | u32 nr_rdma_attrs; | ||
374 | u32 rdma_attrs; | ||
375 | }; | ||
376 | |||
377 | struct nfsd4_create_session { | ||
378 | clientid_t clientid; | ||
379 | struct nfs4_sessionid sessionid; | ||
380 | u32 seqid; | ||
381 | u32 flags; | ||
382 | struct nfsd4_channel_attrs fore_channel; | ||
383 | struct nfsd4_channel_attrs back_channel; | ||
384 | u32 callback_prog; | ||
385 | u32 uid; | ||
386 | u32 gid; | ||
387 | }; | ||
388 | |||
389 | struct nfsd4_sequence { | ||
390 | struct nfs4_sessionid sessionid; /* request/response */ | ||
391 | u32 seqid; /* request/response */ | ||
392 | u32 slotid; /* request/response */ | ||
393 | u32 maxslots; /* request/response */ | ||
394 | u32 cachethis; /* request */ | ||
395 | #if 0 | ||
396 | u32 target_maxslots; /* response */ | ||
397 | u32 status_flags; /* response */ | ||
398 | #endif /* not yet */ | ||
399 | }; | ||
400 | |||
401 | struct nfsd4_destroy_session { | ||
402 | struct nfs4_sessionid sessionid; | ||
403 | }; | ||
404 | |||
347 | struct nfsd4_op { | 405 | struct nfsd4_op { |
348 | int opnum; | 406 | int opnum; |
349 | __be32 status; | 407 | __be32 status; |
@@ -378,6 +436,12 @@ struct nfsd4_op { | |||
378 | struct nfsd4_verify verify; | 436 | struct nfsd4_verify verify; |
379 | struct nfsd4_write write; | 437 | struct nfsd4_write write; |
380 | struct nfsd4_release_lockowner release_lockowner; | 438 | struct nfsd4_release_lockowner release_lockowner; |
439 | |||
440 | /* NFSv4.1 */ | ||
441 | struct nfsd4_exchange_id exchange_id; | ||
442 | struct nfsd4_create_session create_session; | ||
443 | struct nfsd4_destroy_session destroy_session; | ||
444 | struct nfsd4_sequence sequence; | ||
381 | } u; | 445 | } u; |
382 | struct nfs4_replay * replay; | 446 | struct nfs4_replay * replay; |
383 | }; | 447 | }; |
@@ -416,9 +480,22 @@ struct nfsd4_compoundres { | |||
416 | u32 taglen; | 480 | u32 taglen; |
417 | char * tag; | 481 | char * tag; |
418 | u32 opcnt; | 482 | u32 opcnt; |
419 | __be32 * tagp; /* where to encode tag and opcount */ | 483 | __be32 * tagp; /* tag, opcount encode location */ |
484 | struct nfsd4_compound_state cstate; | ||
420 | }; | 485 | }; |
421 | 486 | ||
487 | static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp) | ||
488 | { | ||
489 | struct nfsd4_compoundargs *args = resp->rqstp->rq_argp; | ||
490 | return args->opcnt == 1; | ||
491 | } | ||
492 | |||
493 | static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp) | ||
494 | { | ||
495 | return !resp->cstate.slot->sl_cache_entry.ce_cachethis || | ||
496 | nfsd4_is_solo_sequence(resp); | ||
497 | } | ||
498 | |||
422 | #define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) | 499 | #define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) |
423 | 500 | ||
424 | static inline void | 501 | static inline void |
@@ -448,7 +525,23 @@ extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp, | |||
448 | extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp, | 525 | extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp, |
449 | struct nfsd4_compound_state *, | 526 | struct nfsd4_compound_state *, |
450 | struct nfsd4_setclientid_confirm *setclientid_confirm); | 527 | struct nfsd4_setclientid_confirm *setclientid_confirm); |
451 | extern __be32 nfsd4_process_open1(struct nfsd4_open *open); | 528 | extern void nfsd4_store_cache_entry(struct nfsd4_compoundres *resp); |
529 | extern __be32 nfsd4_replay_cache_entry(struct nfsd4_compoundres *resp, | ||
530 | struct nfsd4_sequence *seq); | ||
531 | extern __be32 nfsd4_exchange_id(struct svc_rqst *rqstp, | ||
532 | struct nfsd4_compound_state *, | ||
533 | struct nfsd4_exchange_id *); | ||
534 | extern __be32 nfsd4_create_session(struct svc_rqst *, | ||
535 | struct nfsd4_compound_state *, | ||
536 | struct nfsd4_create_session *); | ||
537 | extern __be32 nfsd4_sequence(struct svc_rqst *, | ||
538 | struct nfsd4_compound_state *, | ||
539 | struct nfsd4_sequence *); | ||
540 | extern __be32 nfsd4_destroy_session(struct svc_rqst *, | ||
541 | struct nfsd4_compound_state *, | ||
542 | struct nfsd4_destroy_session *); | ||
543 | extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *, | ||
544 | struct nfsd4_open *open); | ||
452 | extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp, | 545 | extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp, |
453 | struct svc_fh *current_fh, struct nfsd4_open *open); | 546 | struct svc_fh *current_fh, struct nfsd4_open *open); |
454 | extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp, | 547 | extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp, |