aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-10-25 09:42:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-25 09:42:01 -0400
commit1442d1678ca7e53574fd403ba7bee6f4125d920c (patch)
treefd053a849158d2c5b8345ced8982108825b85736 /include/linux
parent7e0bb71e75020348bee523720a0c2f04cc72f540 (diff)
parent345c284290cabb5484df909303e73d6def8ec8ec (diff)
Merge branch 'for-3.2' of git://linux-nfs.org/~bfields/linux
* 'for-3.2' of git://linux-nfs.org/~bfields/linux: (103 commits) nfs41: implement DESTROY_CLIENTID operation nfsd4: typo logical vs bitwise negate for want_mask nfsd4: allow NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL | NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED nfsd4: seq->status_flags may be used unitialized nfsd41: use SEQ4_STATUS_BACKCHANNEL_FAULT when cb_sequence is invalid nfsd4: implement new 4.1 open reclaim types nfsd4: remove unneeded CLAIM_DELEGATE_CUR workaround nfsd4: warn on open failure after create nfsd4: preallocate open stateid in process_open1() nfsd4: do idr preallocation with stateid allocation nfsd4: preallocate nfs4_file in process_open1() nfsd4: clean up open owners on OPEN failure nfsd4: simplify process_open1 logic nfsd4: make is_open_owner boolean nfsd4: centralize renew_client() calls nfsd4: typo logical vs bitwise negate nfs: fix bug about IPv6 address scope checking nfsd4: more robust ignoring of WANT bits in OPEN nfsd4: move name-length checks to xdr nfsd4: move access/deny validity checks to xdr code ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/fs.h8
-rw-r--r--include/linux/nfs4.h21
-rw-r--r--include/linux/nfsd/Kbuild2
-rw-r--r--include/linux/nfsd/const.h55
-rw-r--r--include/linux/nfsd/export.h2
-rw-r--r--include/linux/nfsd/nfsfh.h7
-rw-r--r--include/linux/nfsd/syscall.h116
-rw-r--r--include/linux/sunrpc/clnt.h8
-rw-r--r--include/linux/sunrpc/svc.h32
9 files changed, 61 insertions, 190 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 277f497923a2..ba98668a1826 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1063,6 +1063,8 @@ static inline int file_check_writeable(struct file *filp)
1063#define FL_LEASE 32 /* lease held on this file */ 1063#define FL_LEASE 32 /* lease held on this file */
1064#define FL_CLOSE 64 /* unlock on close */ 1064#define FL_CLOSE 64 /* unlock on close */
1065#define FL_SLEEP 128 /* A blocking lock */ 1065#define FL_SLEEP 128 /* A blocking lock */
1066#define FL_DOWNGRADE_PENDING 256 /* Lease is being downgraded */
1067#define FL_UNLOCK_PENDING 512 /* Lease is being broken */
1066 1068
1067/* 1069/*
1068 * Special return value from posix_lock_file() and vfs_lock_file() for 1070 * Special return value from posix_lock_file() and vfs_lock_file() for
@@ -1109,7 +1111,7 @@ struct file_lock {
1109 struct list_head fl_link; /* doubly linked list of all locks */ 1111 struct list_head fl_link; /* doubly linked list of all locks */
1110 struct list_head fl_block; /* circular list of blocked processes */ 1112 struct list_head fl_block; /* circular list of blocked processes */
1111 fl_owner_t fl_owner; 1113 fl_owner_t fl_owner;
1112 unsigned char fl_flags; 1114 unsigned int fl_flags;
1113 unsigned char fl_type; 1115 unsigned char fl_type;
1114 unsigned int fl_pid; 1116 unsigned int fl_pid;
1115 struct pid *fl_nspid; 1117 struct pid *fl_nspid;
@@ -1119,7 +1121,9 @@ struct file_lock {
1119 loff_t fl_end; 1121 loff_t fl_end;
1120 1122
1121 struct fasync_struct * fl_fasync; /* for lease break notifications */ 1123 struct fasync_struct * fl_fasync; /* for lease break notifications */
1122 unsigned long fl_break_time; /* for nonblocking lease breaks */ 1124 /* for lease breaks: */
1125 unsigned long fl_break_time;
1126 unsigned long fl_downgrade_time;
1123 1127
1124 const struct file_lock_operations *fl_ops; /* Callbacks for filesystems */ 1128 const struct file_lock_operations *fl_ops; /* Callbacks for filesystems */
1125 const struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */ 1129 const struct lock_manager_operations *fl_lmops; /* Callbacks for lockmanagers */
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 76f99e8714f3..32345c2805c0 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -373,6 +373,22 @@ enum nfsstat4 {
373 NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */ 373 NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */
374}; 374};
375 375
376static inline bool seqid_mutating_err(u32 err)
377{
378 /* rfc 3530 section 8.1.5: */
379 switch (err) {
380 case NFS4ERR_STALE_CLIENTID:
381 case NFS4ERR_STALE_STATEID:
382 case NFS4ERR_BAD_STATEID:
383 case NFS4ERR_BAD_SEQID:
384 case NFS4ERR_BADXDR:
385 case NFS4ERR_RESOURCE:
386 case NFS4ERR_NOFILEHANDLE:
387 return false;
388 };
389 return true;
390}
391
376/* 392/*
377 * Note: NF4BAD is not actually part of the protocol; it is just used 393 * Note: NF4BAD is not actually part of the protocol; it is just used
378 * internally by nfsd. 394 * internally by nfsd.
@@ -394,7 +410,10 @@ enum open_claim_type4 {
394 NFS4_OPEN_CLAIM_NULL = 0, 410 NFS4_OPEN_CLAIM_NULL = 0,
395 NFS4_OPEN_CLAIM_PREVIOUS = 1, 411 NFS4_OPEN_CLAIM_PREVIOUS = 1,
396 NFS4_OPEN_CLAIM_DELEGATE_CUR = 2, 412 NFS4_OPEN_CLAIM_DELEGATE_CUR = 2,
397 NFS4_OPEN_CLAIM_DELEGATE_PREV = 3 413 NFS4_OPEN_CLAIM_DELEGATE_PREV = 3,
414 NFS4_OPEN_CLAIM_FH = 4, /* 4.1 */
415 NFS4_OPEN_CLAIM_DELEG_CUR_FH = 5, /* 4.1 */
416 NFS4_OPEN_CLAIM_DELEG_PREV_FH = 6, /* 4.1 */
398}; 417};
399 418
400enum opentype4 { 419enum opentype4 {
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild
index 55d1467de3c1..b8d4001212b3 100644
--- a/include/linux/nfsd/Kbuild
+++ b/include/linux/nfsd/Kbuild
@@ -1,6 +1,4 @@
1header-y += const.h
2header-y += debug.h 1header-y += debug.h
3header-y += export.h 2header-y += export.h
4header-y += nfsfh.h 3header-y += nfsfh.h
5header-y += stats.h 4header-y += stats.h
6header-y += syscall.h
diff --git a/include/linux/nfsd/const.h b/include/linux/nfsd/const.h
deleted file mode 100644
index 323f8cfa060a..000000000000
--- a/include/linux/nfsd/const.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * include/linux/nfsd/const.h
3 *
4 * Various constants related to NFS.
5 *
6 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef _LINUX_NFSD_CONST_H
10#define _LINUX_NFSD_CONST_H
11
12#include <linux/nfs.h>
13#include <linux/nfs2.h>
14#include <linux/nfs3.h>
15#include <linux/nfs4.h>
16
17/*
18 * Maximum protocol version supported by knfsd
19 */
20#define NFSSVC_MAXVERS 3
21
22/*
23 * Maximum blocksizes supported by daemon under various circumstances.
24 */
25#define NFSSVC_MAXBLKSIZE RPCSVC_MAXPAYLOAD
26/* NFSv2 is limited by the protocol specification, see RFC 1094 */
27#define NFSSVC_MAXBLKSIZE_V2 (8*1024)
28
29#ifdef __KERNEL__
30
31#include <linux/sunrpc/msg_prot.h>
32
33/*
34 * Largest number of bytes we need to allocate for an NFS
35 * call or reply. Used to control buffer sizes. We use
36 * the length of v3 WRITE, READDIR and READDIR replies
37 * which are an RPC header, up to 26 XDR units of reply
38 * data, and some page data.
39 *
40 * Note that accuracy here doesn't matter too much as the
41 * size is rounded up to a page size when allocating space.
42 */
43#define NFSD_BUFSIZE ((RPC_MAX_HEADER_WITH_AUTH+26)*XDR_UNIT + NFSSVC_MAXBLKSIZE)
44
45#ifdef CONFIG_NFSD_V4
46# define NFSSVC_XDRSIZE NFS4_SVC_XDRSIZE
47#elif defined(CONFIG_NFSD_V3)
48# define NFSSVC_XDRSIZE NFS3_SVC_XDRSIZE
49#else
50# define NFSSVC_XDRSIZE NFS2_SVC_XDRSIZE
51#endif
52
53#endif /* __KERNEL__ */
54
55#endif /* _LINUX_NFSD_CONST_H */
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 8a31a20efe7e..f85308e688fd 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -96,7 +96,6 @@ struct svc_export {
96 struct auth_domain * ex_client; 96 struct auth_domain * ex_client;
97 int ex_flags; 97 int ex_flags;
98 struct path ex_path; 98 struct path ex_path;
99 char *ex_pathname;
100 uid_t ex_anon_uid; 99 uid_t ex_anon_uid;
101 gid_t ex_anon_gid; 100 gid_t ex_anon_gid;
102 int ex_fsid; 101 int ex_fsid;
@@ -137,6 +136,7 @@ struct svc_export * rqst_exp_get_by_name(struct svc_rqst *,
137 struct path *); 136 struct path *);
138struct svc_export * rqst_exp_parent(struct svc_rqst *, 137struct svc_export * rqst_exp_parent(struct svc_rqst *,
139 struct path *); 138 struct path *);
139struct svc_export * rqst_find_fsidzero_export(struct svc_rqst *);
140int exp_rootfh(struct auth_domain *, 140int exp_rootfh(struct auth_domain *,
141 char *path, struct knfsd_fh *, int maxsize); 141 char *path, struct knfsd_fh *, int maxsize);
142__be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *); 142__be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index f76d80ccec10..ce4743a26015 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -14,11 +14,14 @@
14#ifndef _LINUX_NFSD_FH_H 14#ifndef _LINUX_NFSD_FH_H
15#define _LINUX_NFSD_FH_H 15#define _LINUX_NFSD_FH_H
16 16
17# include <linux/types.h> 17#include <linux/types.h>
18#include <linux/nfs.h>
19#include <linux/nfs2.h>
20#include <linux/nfs3.h>
21#include <linux/nfs4.h>
18#ifdef __KERNEL__ 22#ifdef __KERNEL__
19# include <linux/sunrpc/svc.h> 23# include <linux/sunrpc/svc.h>
20#endif 24#endif
21#include <linux/nfsd/const.h>
22 25
23/* 26/*
24 * This is the old "dentry style" Linux NFSv2 file handle. 27 * This is the old "dentry style" Linux NFSv2 file handle.
diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h
deleted file mode 100644
index 812bc1e160dc..000000000000
--- a/include/linux/nfsd/syscall.h
+++ /dev/null
@@ -1,116 +0,0 @@
1/*
2 * include/linux/nfsd/syscall.h
3 *
4 * This file holds all declarations for the knfsd syscall interface.
5 *
6 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef NFSD_SYSCALL_H
10#define NFSD_SYSCALL_H
11
12#include <linux/types.h>
13#include <linux/nfsd/export.h>
14
15/*
16 * Version of the syscall interface
17 */
18#define NFSCTL_VERSION 0x0201
19
20/*
21 * These are the commands understood by nfsctl().
22 */
23#define NFSCTL_SVC 0 /* This is a server process. */
24#define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */
25#define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */
26#define NFSCTL_EXPORT 3 /* export a file system. */
27#define NFSCTL_UNEXPORT 4 /* unexport a file system. */
28/*#define NFSCTL_UGIDUPDATE 5 / * update a client's uid/gid map. DISCARDED */
29/*#define NFSCTL_GETFH 6 / * get an fh by ino DISCARDED */
30#define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */
31#define NFSCTL_GETFS 8 /* get an fh by path with max FH len */
32
33/* SVC */
34struct nfsctl_svc {
35 unsigned short svc_port;
36 int svc_nthreads;
37};
38
39/* ADDCLIENT/DELCLIENT */
40struct nfsctl_client {
41 char cl_ident[NFSCLNT_IDMAX+1];
42 int cl_naddr;
43 struct in_addr cl_addrlist[NFSCLNT_ADDRMAX];
44 int cl_fhkeytype;
45 int cl_fhkeylen;
46 unsigned char cl_fhkey[NFSCLNT_KEYMAX];
47};
48
49/* EXPORT/UNEXPORT */
50struct nfsctl_export {
51 char ex_client[NFSCLNT_IDMAX+1];
52 char ex_path[NFS_MAXPATHLEN+1];
53 __kernel_old_dev_t ex_dev;
54 __kernel_ino_t ex_ino;
55 int ex_flags;
56 __kernel_uid_t ex_anon_uid;
57 __kernel_gid_t ex_anon_gid;
58};
59
60/* GETFD */
61struct nfsctl_fdparm {
62 struct sockaddr gd_addr;
63 char gd_path[NFS_MAXPATHLEN+1];
64 int gd_version;
65};
66
67/* GETFS - GET Filehandle with Size */
68struct nfsctl_fsparm {
69 struct sockaddr gd_addr;
70 char gd_path[NFS_MAXPATHLEN+1];
71 int gd_maxlen;
72};
73
74/*
75 * This is the argument union.
76 */
77struct nfsctl_arg {
78 int ca_version; /* safeguard */
79 union {
80 struct nfsctl_svc u_svc;
81 struct nfsctl_client u_client;
82 struct nfsctl_export u_export;
83 struct nfsctl_fdparm u_getfd;
84 struct nfsctl_fsparm u_getfs;
85 /*
86 * The following dummy member is needed to preserve binary compatibility
87 * on platforms where alignof(void*)>alignof(int). It's needed because
88 * this union used to contain a member (u_umap) which contained a
89 * pointer.
90 */
91 void *u_ptr;
92 } u;
93#define ca_svc u.u_svc
94#define ca_client u.u_client
95#define ca_export u.u_export
96#define ca_getfd u.u_getfd
97#define ca_getfs u.u_getfs
98};
99
100union nfsctl_res {
101 __u8 cr_getfh[NFS_FHSIZE];
102 struct knfsd_fh cr_getfs;
103};
104
105#ifdef __KERNEL__
106/*
107 * Kernel syscall implementation.
108 */
109extern int exp_addclient(struct nfsctl_client *ncp);
110extern int exp_delclient(struct nfsctl_client *ncp);
111extern int exp_export(struct nfsctl_export *nxp);
112extern int exp_unexport(struct nfsctl_export *nxp);
113
114#endif /* __KERNEL__ */
115
116#endif /* NFSD_SYSCALL_H */
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index db7bcaf7c5bd..ee1bb67f525e 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -218,7 +218,13 @@ static inline bool __rpc_cmp_addr6(const struct sockaddr *sap1,
218{ 218{
219 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1; 219 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
220 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2; 220 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
221 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr); 221
222 if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr))
223 return false;
224 else if (ipv6_addr_type(&sin1->sin6_addr) & IPV6_ADDR_LINKLOCAL)
225 return sin1->sin6_scope_id == sin2->sin6_scope_id;
226
227 return true;
222} 228}
223 229
224static inline bool __rpc_copy_addr6(struct sockaddr *dst, 230static inline bool __rpc_copy_addr6(struct sockaddr *dst,
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 223588a976a0..d8d5d93071b3 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -212,11 +212,6 @@ static inline void svc_putu32(struct kvec *iov, __be32 val)
212 iov->iov_len += sizeof(__be32); 212 iov->iov_len += sizeof(__be32);
213} 213}
214 214
215union svc_addr_u {
216 struct in_addr addr;
217 struct in6_addr addr6;
218};
219
220/* 215/*
221 * The context of a single thread, including the request currently being 216 * The context of a single thread, including the request currently being
222 * processed. 217 * processed.
@@ -225,8 +220,12 @@ struct svc_rqst {
225 struct list_head rq_list; /* idle list */ 220 struct list_head rq_list; /* idle list */
226 struct list_head rq_all; /* all threads list */ 221 struct list_head rq_all; /* all threads list */
227 struct svc_xprt * rq_xprt; /* transport ptr */ 222 struct svc_xprt * rq_xprt; /* transport ptr */
223
228 struct sockaddr_storage rq_addr; /* peer address */ 224 struct sockaddr_storage rq_addr; /* peer address */
229 size_t rq_addrlen; 225 size_t rq_addrlen;
226 struct sockaddr_storage rq_daddr; /* dest addr of request
227 * - reply from here */
228 size_t rq_daddrlen;
230 229
231 struct svc_serv * rq_server; /* RPC service definition */ 230 struct svc_serv * rq_server; /* RPC service definition */
232 struct svc_pool * rq_pool; /* thread pool */ 231 struct svc_pool * rq_pool; /* thread pool */
@@ -255,9 +254,6 @@ struct svc_rqst {
255 unsigned short 254 unsigned short
256 rq_secure : 1; /* secure port */ 255 rq_secure : 1; /* secure port */
257 256
258 union svc_addr_u rq_daddr; /* dest addr of request
259 * - reply from here */
260
261 void * rq_argp; /* decoded arguments */ 257 void * rq_argp; /* decoded arguments */
262 void * rq_resp; /* xdr'd results */ 258 void * rq_resp; /* xdr'd results */
263 void * rq_auth_data; /* flavor-specific data */ 259 void * rq_auth_data; /* flavor-specific data */
@@ -300,6 +296,21 @@ static inline struct sockaddr *svc_addr(const struct svc_rqst *rqst)
300 return (struct sockaddr *) &rqst->rq_addr; 296 return (struct sockaddr *) &rqst->rq_addr;
301} 297}
302 298
299static inline struct sockaddr_in *svc_daddr_in(const struct svc_rqst *rqst)
300{
301 return (struct sockaddr_in *) &rqst->rq_daddr;
302}
303
304static inline struct sockaddr_in6 *svc_daddr_in6(const struct svc_rqst *rqst)
305{
306 return (struct sockaddr_in6 *) &rqst->rq_daddr;
307}
308
309static inline struct sockaddr *svc_daddr(const struct svc_rqst *rqst)
310{
311 return (struct sockaddr *) &rqst->rq_daddr;
312}
313
303/* 314/*
304 * Check buffer bounds after decoding arguments 315 * Check buffer bounds after decoding arguments
305 */ 316 */
@@ -340,7 +351,8 @@ struct svc_deferred_req {
340 struct svc_xprt *xprt; 351 struct svc_xprt *xprt;
341 struct sockaddr_storage addr; /* where reply must go */ 352 struct sockaddr_storage addr; /* where reply must go */
342 size_t addrlen; 353 size_t addrlen;
343 union svc_addr_u daddr; /* where reply must come from */ 354 struct sockaddr_storage daddr; /* where reply must come from */
355 size_t daddrlen;
344 struct cache_deferred_req handle; 356 struct cache_deferred_req handle;
345 size_t xprt_hlen; 357 size_t xprt_hlen;
346 int argslen; 358 int argslen;
@@ -404,7 +416,7 @@ struct svc_procedure {
404struct svc_serv *svc_create(struct svc_program *, unsigned int, 416struct svc_serv *svc_create(struct svc_program *, unsigned int,
405 void (*shutdown)(struct svc_serv *)); 417 void (*shutdown)(struct svc_serv *));
406struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, 418struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
407 struct svc_pool *pool); 419 struct svc_pool *pool, int node);
408void svc_exit_thread(struct svc_rqst *); 420void svc_exit_thread(struct svc_rqst *);
409struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, 421struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
410 void (*shutdown)(struct svc_serv *), 422 void (*shutdown)(struct svc_serv *),