diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/lockd/xdr.h | 12 | ||||
-rw-r--r-- | include/linux/lockd/xdr4.h | 10 | ||||
-rw-r--r-- | include/linux/nfs.h | 1 | ||||
-rw-r--r-- | include/linux/nfs4.h | 138 | ||||
-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 | ||||
-rw-r--r-- | include/linux/sunrpc/svc.h | 16 | ||||
-rw-r--r-- | include/linux/sunrpc/xdr.h | 42 |
12 files changed, 543 insertions, 138 deletions
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h index 7dc5b6cb44cd..d39ed1cc5fbf 100644 --- a/include/linux/lockd/xdr.h +++ b/include/linux/lockd/xdr.h | |||
@@ -25,13 +25,13 @@ struct svc_rqst; | |||
25 | #define NLM_MAXCOOKIELEN 32 | 25 | #define NLM_MAXCOOKIELEN 32 |
26 | #define NLM_MAXSTRLEN 1024 | 26 | #define NLM_MAXSTRLEN 1024 |
27 | 27 | ||
28 | #define nlm_granted __constant_htonl(NLM_LCK_GRANTED) | 28 | #define nlm_granted cpu_to_be32(NLM_LCK_GRANTED) |
29 | #define nlm_lck_denied __constant_htonl(NLM_LCK_DENIED) | 29 | #define nlm_lck_denied cpu_to_be32(NLM_LCK_DENIED) |
30 | #define nlm_lck_denied_nolocks __constant_htonl(NLM_LCK_DENIED_NOLOCKS) | 30 | #define nlm_lck_denied_nolocks cpu_to_be32(NLM_LCK_DENIED_NOLOCKS) |
31 | #define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED) | 31 | #define nlm_lck_blocked cpu_to_be32(NLM_LCK_BLOCKED) |
32 | #define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD) | 32 | #define nlm_lck_denied_grace_period cpu_to_be32(NLM_LCK_DENIED_GRACE_PERIOD) |
33 | 33 | ||
34 | #define nlm_drop_reply __constant_htonl(30000) | 34 | #define nlm_drop_reply cpu_to_be32(30000) |
35 | 35 | ||
36 | /* Lock info passed via NLM */ | 36 | /* Lock info passed via NLM */ |
37 | struct nlm_lock { | 37 | struct nlm_lock { |
diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h index 12bfe09de2b1..7353821341ed 100644 --- a/include/linux/lockd/xdr4.h +++ b/include/linux/lockd/xdr4.h | |||
@@ -15,11 +15,11 @@ | |||
15 | #include <linux/lockd/xdr.h> | 15 | #include <linux/lockd/xdr.h> |
16 | 16 | ||
17 | /* error codes new to NLMv4 */ | 17 | /* error codes new to NLMv4 */ |
18 | #define nlm4_deadlock __constant_htonl(NLM_DEADLCK) | 18 | #define nlm4_deadlock cpu_to_be32(NLM_DEADLCK) |
19 | #define nlm4_rofs __constant_htonl(NLM_ROFS) | 19 | #define nlm4_rofs cpu_to_be32(NLM_ROFS) |
20 | #define nlm4_stale_fh __constant_htonl(NLM_STALE_FH) | 20 | #define nlm4_stale_fh cpu_to_be32(NLM_STALE_FH) |
21 | #define nlm4_fbig __constant_htonl(NLM_FBIG) | 21 | #define nlm4_fbig cpu_to_be32(NLM_FBIG) |
22 | #define nlm4_failed __constant_htonl(NLM_FAILED) | 22 | #define nlm4_failed cpu_to_be32(NLM_FAILED) |
23 | 23 | ||
24 | 24 | ||
25 | 25 | ||
diff --git a/include/linux/nfs.h b/include/linux/nfs.h index 54af92c1c70b..214d499718f7 100644 --- a/include/linux/nfs.h +++ b/include/linux/nfs.h | |||
@@ -109,7 +109,6 @@ | |||
109 | NFSERR_FILE_OPEN = 10046, /* v4 */ | 109 | NFSERR_FILE_OPEN = 10046, /* v4 */ |
110 | NFSERR_ADMIN_REVOKED = 10047, /* v4 */ | 110 | NFSERR_ADMIN_REVOKED = 10047, /* v4 */ |
111 | NFSERR_CB_PATH_DOWN = 10048, /* v4 */ | 111 | NFSERR_CB_PATH_DOWN = 10048, /* v4 */ |
112 | NFSERR_REPLAY_ME = 10049 /* v4 */ | ||
113 | }; | 112 | }; |
114 | 113 | ||
115 | /* NFSv2 file types - beware, these are not the same in NFSv3 */ | 114 | /* NFSv2 file types - beware, these are not the same in NFSv3 */ |
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index b912311a56b1..e3f0cbcbd0db 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define NFS4_FHSIZE 128 | 21 | #define NFS4_FHSIZE 128 |
22 | #define NFS4_MAXPATHLEN PATH_MAX | 22 | #define NFS4_MAXPATHLEN PATH_MAX |
23 | #define NFS4_MAXNAMLEN NAME_MAX | 23 | #define NFS4_MAXNAMLEN NAME_MAX |
24 | #define NFS4_MAX_SESSIONID_LEN 16 | ||
24 | 25 | ||
25 | #define NFS4_ACCESS_READ 0x0001 | 26 | #define NFS4_ACCESS_READ 0x0001 |
26 | #define NFS4_ACCESS_LOOKUP 0x0002 | 27 | #define NFS4_ACCESS_LOOKUP 0x0002 |
@@ -38,6 +39,7 @@ | |||
38 | #define NFS4_OPEN_RESULT_CONFIRM 0x0002 | 39 | #define NFS4_OPEN_RESULT_CONFIRM 0x0002 |
39 | #define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004 | 40 | #define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004 |
40 | 41 | ||
42 | #define NFS4_SHARE_ACCESS_MASK 0x000F | ||
41 | #define NFS4_SHARE_ACCESS_READ 0x0001 | 43 | #define NFS4_SHARE_ACCESS_READ 0x0001 |
42 | #define NFS4_SHARE_ACCESS_WRITE 0x0002 | 44 | #define NFS4_SHARE_ACCESS_WRITE 0x0002 |
43 | #define NFS4_SHARE_ACCESS_BOTH 0x0003 | 45 | #define NFS4_SHARE_ACCESS_BOTH 0x0003 |
@@ -45,6 +47,19 @@ | |||
45 | #define NFS4_SHARE_DENY_WRITE 0x0002 | 47 | #define NFS4_SHARE_DENY_WRITE 0x0002 |
46 | #define NFS4_SHARE_DENY_BOTH 0x0003 | 48 | #define NFS4_SHARE_DENY_BOTH 0x0003 |
47 | 49 | ||
50 | /* nfs41 */ | ||
51 | #define NFS4_SHARE_WANT_MASK 0xFF00 | ||
52 | #define NFS4_SHARE_WANT_NO_PREFERENCE 0x0000 | ||
53 | #define NFS4_SHARE_WANT_READ_DELEG 0x0100 | ||
54 | #define NFS4_SHARE_WANT_WRITE_DELEG 0x0200 | ||
55 | #define NFS4_SHARE_WANT_ANY_DELEG 0x0300 | ||
56 | #define NFS4_SHARE_WANT_NO_DELEG 0x0400 | ||
57 | #define NFS4_SHARE_WANT_CANCEL 0x0500 | ||
58 | |||
59 | #define NFS4_SHARE_WHEN_MASK 0xF0000 | ||
60 | #define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000 | ||
61 | #define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED 0x20000 | ||
62 | |||
48 | #define NFS4_SET_TO_SERVER_TIME 0 | 63 | #define NFS4_SET_TO_SERVER_TIME 0 |
49 | #define NFS4_SET_TO_CLIENT_TIME 1 | 64 | #define NFS4_SET_TO_CLIENT_TIME 1 |
50 | 65 | ||
@@ -88,6 +103,31 @@ | |||
88 | #define NFS4_ACE_GENERIC_EXECUTE 0x001200A0 | 103 | #define NFS4_ACE_GENERIC_EXECUTE 0x001200A0 |
89 | #define NFS4_ACE_MASK_ALL 0x001F01FF | 104 | #define NFS4_ACE_MASK_ALL 0x001F01FF |
90 | 105 | ||
106 | #define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001 | ||
107 | #define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002 | ||
108 | #define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000 | ||
109 | #define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000 | ||
110 | #define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000 | ||
111 | #define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000 | ||
112 | #define EXCHGID4_FLAG_CONFIRMED_R 0x80000000 | ||
113 | /* | ||
114 | * Since the validity of these bits depends on whether | ||
115 | * they're set in the argument or response, have separate | ||
116 | * invalid flag masks for arg (_A) and resp (_R). | ||
117 | */ | ||
118 | #define EXCHGID4_FLAG_MASK_A 0x40070003 | ||
119 | #define EXCHGID4_FLAG_MASK_R 0x80070003 | ||
120 | |||
121 | #define SEQ4_STATUS_CB_PATH_DOWN 0x00000001 | ||
122 | #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002 | ||
123 | #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED 0x00000004 | ||
124 | #define SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED 0x00000008 | ||
125 | #define SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED 0x00000010 | ||
126 | #define SEQ4_STATUS_ADMIN_STATE_REVOKED 0x00000020 | ||
127 | #define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040 | ||
128 | #define SEQ4_STATUS_LEASE_MOVED 0x00000080 | ||
129 | #define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100 | ||
130 | |||
91 | #define NFS4_MAX_UINT64 (~(u64)0) | 131 | #define NFS4_MAX_UINT64 (~(u64)0) |
92 | 132 | ||
93 | enum nfs4_acl_whotype { | 133 | enum nfs4_acl_whotype { |
@@ -154,6 +194,28 @@ enum nfs_opnum4 { | |||
154 | OP_VERIFY = 37, | 194 | OP_VERIFY = 37, |
155 | OP_WRITE = 38, | 195 | OP_WRITE = 38, |
156 | OP_RELEASE_LOCKOWNER = 39, | 196 | OP_RELEASE_LOCKOWNER = 39, |
197 | |||
198 | /* nfs41 */ | ||
199 | OP_BACKCHANNEL_CTL = 40, | ||
200 | OP_BIND_CONN_TO_SESSION = 41, | ||
201 | OP_EXCHANGE_ID = 42, | ||
202 | OP_CREATE_SESSION = 43, | ||
203 | OP_DESTROY_SESSION = 44, | ||
204 | OP_FREE_STATEID = 45, | ||
205 | OP_GET_DIR_DELEGATION = 46, | ||
206 | OP_GETDEVICEINFO = 47, | ||
207 | OP_GETDEVICELIST = 48, | ||
208 | OP_LAYOUTCOMMIT = 49, | ||
209 | OP_LAYOUTGET = 50, | ||
210 | OP_LAYOUTRETURN = 51, | ||
211 | OP_SECINFO_NO_NAME = 52, | ||
212 | OP_SEQUENCE = 53, | ||
213 | OP_SET_SSV = 54, | ||
214 | OP_TEST_STATEID = 55, | ||
215 | OP_WANT_DELEGATION = 56, | ||
216 | OP_DESTROY_CLIENTID = 57, | ||
217 | OP_RECLAIM_COMPLETE = 58, | ||
218 | |||
157 | OP_ILLEGAL = 10044, | 219 | OP_ILLEGAL = 10044, |
158 | }; | 220 | }; |
159 | 221 | ||
@@ -230,7 +292,48 @@ enum nfsstat4 { | |||
230 | NFS4ERR_DEADLOCK = 10045, | 292 | NFS4ERR_DEADLOCK = 10045, |
231 | NFS4ERR_FILE_OPEN = 10046, | 293 | NFS4ERR_FILE_OPEN = 10046, |
232 | NFS4ERR_ADMIN_REVOKED = 10047, | 294 | NFS4ERR_ADMIN_REVOKED = 10047, |
233 | NFS4ERR_CB_PATH_DOWN = 10048 | 295 | NFS4ERR_CB_PATH_DOWN = 10048, |
296 | |||
297 | /* nfs41 */ | ||
298 | NFS4ERR_BADIOMODE = 10049, | ||
299 | NFS4ERR_BADLAYOUT = 10050, | ||
300 | NFS4ERR_BAD_SESSION_DIGEST = 10051, | ||
301 | NFS4ERR_BADSESSION = 10052, | ||
302 | NFS4ERR_BADSLOT = 10053, | ||
303 | NFS4ERR_COMPLETE_ALREADY = 10054, | ||
304 | NFS4ERR_CONN_NOT_BOUND_TO_SESSION = 10055, | ||
305 | NFS4ERR_DELEG_ALREADY_WANTED = 10056, | ||
306 | NFS4ERR_BACK_CHAN_BUSY = 10057, /* backchan reqs outstanding */ | ||
307 | NFS4ERR_LAYOUTTRYLATER = 10058, | ||
308 | NFS4ERR_LAYOUTUNAVAILABLE = 10059, | ||
309 | NFS4ERR_NOMATCHING_LAYOUT = 10060, | ||
310 | NFS4ERR_RECALLCONFLICT = 10061, | ||
311 | NFS4ERR_UNKNOWN_LAYOUTTYPE = 10062, | ||
312 | NFS4ERR_SEQ_MISORDERED = 10063, /* unexpected seq.id in req */ | ||
313 | NFS4ERR_SEQUENCE_POS = 10064, /* [CB_]SEQ. op not 1st op */ | ||
314 | NFS4ERR_REQ_TOO_BIG = 10065, /* request too big */ | ||
315 | NFS4ERR_REP_TOO_BIG = 10066, /* reply too big */ | ||
316 | NFS4ERR_REP_TOO_BIG_TO_CACHE = 10067, /* rep. not all cached */ | ||
317 | NFS4ERR_RETRY_UNCACHED_REP = 10068, /* retry & rep. uncached */ | ||
318 | NFS4ERR_UNSAFE_COMPOUND = 10069, /* retry/recovery too hard */ | ||
319 | NFS4ERR_TOO_MANY_OPS = 10070, /* too many ops in [CB_]COMP */ | ||
320 | NFS4ERR_OP_NOT_IN_SESSION = 10071, /* op needs [CB_]SEQ. op */ | ||
321 | NFS4ERR_HASH_ALG_UNSUPP = 10072, /* hash alg. not supp. */ | ||
322 | /* Error 10073 is unused. */ | ||
323 | NFS4ERR_CLIENTID_BUSY = 10074, /* clientid has state */ | ||
324 | NFS4ERR_PNFS_IO_HOLE = 10075, /* IO to _SPARSE file hole */ | ||
325 | NFS4ERR_SEQ_FALSE_RETRY = 10076, /* retry not origional */ | ||
326 | NFS4ERR_BAD_HIGH_SLOT = 10077, /* sequence arg bad */ | ||
327 | NFS4ERR_DEADSESSION = 10078, /* persistent session dead */ | ||
328 | NFS4ERR_ENCR_ALG_UNSUPP = 10079, /* SSV alg mismatch */ | ||
329 | NFS4ERR_PNFS_NO_LAYOUT = 10080, /* direct I/O with no layout */ | ||
330 | NFS4ERR_NOT_ONLY_OP = 10081, /* bad compound */ | ||
331 | NFS4ERR_WRONG_CRED = 10082, /* permissions:state change */ | ||
332 | NFS4ERR_WRONG_TYPE = 10083, /* current operation mismatch */ | ||
333 | NFS4ERR_DIRDELEG_UNAVAIL = 10084, /* no directory delegation */ | ||
334 | NFS4ERR_REJECT_DELEG = 10085, /* on callback */ | ||
335 | NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */ | ||
336 | NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */ | ||
234 | }; | 337 | }; |
235 | 338 | ||
236 | /* | 339 | /* |
@@ -265,7 +368,13 @@ enum opentype4 { | |||
265 | enum createmode4 { | 368 | enum createmode4 { |
266 | NFS4_CREATE_UNCHECKED = 0, | 369 | NFS4_CREATE_UNCHECKED = 0, |
267 | NFS4_CREATE_GUARDED = 1, | 370 | NFS4_CREATE_GUARDED = 1, |
268 | NFS4_CREATE_EXCLUSIVE = 2 | 371 | NFS4_CREATE_EXCLUSIVE = 2, |
372 | /* | ||
373 | * New to NFSv4.1. If session is persistent, | ||
374 | * GUARDED4 MUST be used. Otherwise, use | ||
375 | * EXCLUSIVE4_1 instead of EXCLUSIVE4. | ||
376 | */ | ||
377 | NFS4_CREATE_EXCLUSIVE4_1 = 3 | ||
269 | }; | 378 | }; |
270 | 379 | ||
271 | enum limit_by4 { | 380 | enum limit_by4 { |
@@ -301,6 +410,8 @@ enum lock_type4 { | |||
301 | #define FATTR4_WORD0_UNIQUE_HANDLES (1UL << 9) | 410 | #define FATTR4_WORD0_UNIQUE_HANDLES (1UL << 9) |
302 | #define FATTR4_WORD0_LEASE_TIME (1UL << 10) | 411 | #define FATTR4_WORD0_LEASE_TIME (1UL << 10) |
303 | #define FATTR4_WORD0_RDATTR_ERROR (1UL << 11) | 412 | #define FATTR4_WORD0_RDATTR_ERROR (1UL << 11) |
413 | /* Mandatory in NFSv4.1 */ | ||
414 | #define FATTR4_WORD2_SUPPATTR_EXCLCREAT (1UL << 11) | ||
304 | 415 | ||
305 | /* Recommended Attributes */ | 416 | /* Recommended Attributes */ |
306 | #define FATTR4_WORD0_ACL (1UL << 12) | 417 | #define FATTR4_WORD0_ACL (1UL << 12) |
@@ -391,6 +502,29 @@ enum { | |||
391 | NFSPROC4_CLNT_GETACL, | 502 | NFSPROC4_CLNT_GETACL, |
392 | NFSPROC4_CLNT_SETACL, | 503 | NFSPROC4_CLNT_SETACL, |
393 | NFSPROC4_CLNT_FS_LOCATIONS, | 504 | NFSPROC4_CLNT_FS_LOCATIONS, |
505 | |||
506 | /* nfs41 */ | ||
507 | NFSPROC4_CLNT_EXCHANGE_ID, | ||
508 | NFSPROC4_CLNT_CREATE_SESSION, | ||
509 | NFSPROC4_CLNT_DESTROY_SESSION, | ||
510 | NFSPROC4_CLNT_SEQUENCE, | ||
511 | NFSPROC4_CLNT_GET_LEASE_TIME, | ||
512 | }; | ||
513 | |||
514 | /* nfs41 types */ | ||
515 | struct nfs4_sessionid { | ||
516 | unsigned char data[NFS4_MAX_SESSIONID_LEN]; | ||
517 | }; | ||
518 | |||
519 | /* Create Session Flags */ | ||
520 | #define SESSION4_PERSIST 0x001 | ||
521 | #define SESSION4_BACK_CHAN 0x002 | ||
522 | #define SESSION4_RDMA 0x004 | ||
523 | |||
524 | enum state_protect_how4 { | ||
525 | SP4_NONE = 0, | ||
526 | SP4_MACH_CRED = 1, | ||
527 | SP4_SSV = 2 | ||
394 | }; | 528 | }; |
395 | 529 | ||
396 | #endif | 530 | #endif |
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, |
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index d3a4c0231933..2a30775959e9 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -24,6 +24,15 @@ | |||
24 | */ | 24 | */ |
25 | typedef int (*svc_thread_fn)(void *); | 25 | typedef int (*svc_thread_fn)(void *); |
26 | 26 | ||
27 | /* statistics for svc_pool structures */ | ||
28 | struct svc_pool_stats { | ||
29 | unsigned long packets; | ||
30 | unsigned long sockets_queued; | ||
31 | unsigned long threads_woken; | ||
32 | unsigned long overloads_avoided; | ||
33 | unsigned long threads_timedout; | ||
34 | }; | ||
35 | |||
27 | /* | 36 | /* |
28 | * | 37 | * |
29 | * RPC service thread pool. | 38 | * RPC service thread pool. |
@@ -41,6 +50,8 @@ struct svc_pool { | |||
41 | struct list_head sp_sockets; /* pending sockets */ | 50 | struct list_head sp_sockets; /* pending sockets */ |
42 | unsigned int sp_nrthreads; /* # of threads in pool */ | 51 | unsigned int sp_nrthreads; /* # of threads in pool */ |
43 | struct list_head sp_all_threads; /* all server threads */ | 52 | struct list_head sp_all_threads; /* all server threads */ |
53 | int sp_nwaking; /* number of threads woken but not yet active */ | ||
54 | struct svc_pool_stats sp_stats; /* statistics on pool operation */ | ||
44 | } ____cacheline_aligned_in_smp; | 55 | } ____cacheline_aligned_in_smp; |
45 | 56 | ||
46 | /* | 57 | /* |
@@ -83,6 +94,8 @@ struct svc_serv { | |||
83 | struct module * sv_module; /* optional module to count when | 94 | struct module * sv_module; /* optional module to count when |
84 | * adding threads */ | 95 | * adding threads */ |
85 | 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 */ | ||
86 | }; | 99 | }; |
87 | 100 | ||
88 | /* | 101 | /* |
@@ -218,6 +231,7 @@ struct svc_rqst { | |||
218 | struct svc_cred rq_cred; /* auth info */ | 231 | struct svc_cred rq_cred; /* auth info */ |
219 | void * rq_xprt_ctxt; /* transport specific context ptr */ | 232 | void * rq_xprt_ctxt; /* transport specific context ptr */ |
220 | struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ | 233 | struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ |
234 | int rq_usedeferral; /* use deferral */ | ||
221 | 235 | ||
222 | size_t rq_xprt_hlen; /* xprt header len */ | 236 | size_t rq_xprt_hlen; /* xprt header len */ |
223 | struct xdr_buf rq_arg; | 237 | struct xdr_buf rq_arg; |
@@ -263,6 +277,7 @@ struct svc_rqst { | |||
263 | * cache pages */ | 277 | * cache pages */ |
264 | wait_queue_head_t rq_wait; /* synchronization */ | 278 | wait_queue_head_t rq_wait; /* synchronization */ |
265 | struct task_struct *rq_task; /* service thread */ | 279 | struct task_struct *rq_task; /* service thread */ |
280 | int rq_waking; /* 1 if thread is being woken */ | ||
266 | }; | 281 | }; |
267 | 282 | ||
268 | /* | 283 | /* |
@@ -393,6 +408,7 @@ struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, | |||
393 | void (*shutdown)(struct svc_serv *), | 408 | void (*shutdown)(struct svc_serv *), |
394 | svc_thread_fn, struct module *); | 409 | svc_thread_fn, struct module *); |
395 | int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); | 410 | int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); |
411 | int svc_pool_stats_open(struct svc_serv *serv, struct file *file); | ||
396 | void svc_destroy(struct svc_serv *); | 412 | void svc_destroy(struct svc_serv *); |
397 | int svc_process(struct svc_rqst *); | 413 | int svc_process(struct svc_rqst *); |
398 | int svc_register(const struct svc_serv *, const int, | 414 | int svc_register(const struct svc_serv *, const int, |
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index 49e1eb454465..d8910b68e1bd 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h | |||
@@ -69,27 +69,27 @@ struct xdr_buf { | |||
69 | * pre-xdr'ed macros. | 69 | * pre-xdr'ed macros. |
70 | */ | 70 | */ |
71 | 71 | ||
72 | #define xdr_zero __constant_htonl(0) | 72 | #define xdr_zero cpu_to_be32(0) |
73 | #define xdr_one __constant_htonl(1) | 73 | #define xdr_one cpu_to_be32(1) |
74 | #define xdr_two __constant_htonl(2) | 74 | #define xdr_two cpu_to_be32(2) |
75 | 75 | ||
76 | #define rpc_success __constant_htonl(RPC_SUCCESS) | 76 | #define rpc_success cpu_to_be32(RPC_SUCCESS) |
77 | #define rpc_prog_unavail __constant_htonl(RPC_PROG_UNAVAIL) | 77 | #define rpc_prog_unavail cpu_to_be32(RPC_PROG_UNAVAIL) |
78 | #define rpc_prog_mismatch __constant_htonl(RPC_PROG_MISMATCH) | 78 | #define rpc_prog_mismatch cpu_to_be32(RPC_PROG_MISMATCH) |
79 | #define rpc_proc_unavail __constant_htonl(RPC_PROC_UNAVAIL) | 79 | #define rpc_proc_unavail cpu_to_be32(RPC_PROC_UNAVAIL) |
80 | #define rpc_garbage_args __constant_htonl(RPC_GARBAGE_ARGS) | 80 | #define rpc_garbage_args cpu_to_be32(RPC_GARBAGE_ARGS) |
81 | #define rpc_system_err __constant_htonl(RPC_SYSTEM_ERR) | 81 | #define rpc_system_err cpu_to_be32(RPC_SYSTEM_ERR) |
82 | #define rpc_drop_reply __constant_htonl(RPC_DROP_REPLY) | 82 | #define rpc_drop_reply cpu_to_be32(RPC_DROP_REPLY) |
83 | 83 | ||
84 | #define rpc_auth_ok __constant_htonl(RPC_AUTH_OK) | 84 | #define rpc_auth_ok cpu_to_be32(RPC_AUTH_OK) |
85 | #define rpc_autherr_badcred __constant_htonl(RPC_AUTH_BADCRED) | 85 | #define rpc_autherr_badcred cpu_to_be32(RPC_AUTH_BADCRED) |
86 | #define rpc_autherr_rejectedcred __constant_htonl(RPC_AUTH_REJECTEDCRED) | 86 | #define rpc_autherr_rejectedcred cpu_to_be32(RPC_AUTH_REJECTEDCRED) |
87 | #define rpc_autherr_badverf __constant_htonl(RPC_AUTH_BADVERF) | 87 | #define rpc_autherr_badverf cpu_to_be32(RPC_AUTH_BADVERF) |
88 | #define rpc_autherr_rejectedverf __constant_htonl(RPC_AUTH_REJECTEDVERF) | 88 | #define rpc_autherr_rejectedverf cpu_to_be32(RPC_AUTH_REJECTEDVERF) |
89 | #define rpc_autherr_tooweak __constant_htonl(RPC_AUTH_TOOWEAK) | 89 | #define rpc_autherr_tooweak cpu_to_be32(RPC_AUTH_TOOWEAK) |
90 | #define rpcsec_gsserr_credproblem __constant_htonl(RPCSEC_GSS_CREDPROBLEM) | 90 | #define rpcsec_gsserr_credproblem cpu_to_be32(RPCSEC_GSS_CREDPROBLEM) |
91 | #define rpcsec_gsserr_ctxproblem __constant_htonl(RPCSEC_GSS_CTXPROBLEM) | 91 | #define rpcsec_gsserr_ctxproblem cpu_to_be32(RPCSEC_GSS_CTXPROBLEM) |
92 | #define rpc_autherr_oldseqnum __constant_htonl(101) | 92 | #define rpc_autherr_oldseqnum cpu_to_be32(101) |
93 | 93 | ||
94 | /* | 94 | /* |
95 | * Miscellaneous XDR helper functions | 95 | * Miscellaneous XDR helper functions |