diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-14 15:31:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-14 15:31:14 -0400 |
commit | 8acd3a60bcca17c6d89c73cee3ad6057eb83ba1e (patch) | |
tree | d610c8d39246c33c499ee9d92d302d3ca9e89ae3 /include/linux | |
parent | c269bc00fcb876ae3b85f178f1e34601185c8ccc (diff) | |
parent | 107e0008dfb8bd6366bc8827f5bbbc0c1f795d2d (diff) |
Merge branch 'for-2.6.28' of git://linux-nfs.org/~bfields/linux
* 'for-2.6.28' of git://linux-nfs.org/~bfields/linux: (59 commits)
svcrdma: Fix IRD/ORD polarity
svcrdma: Update svc_rdma_send_error to use DMA LKEY
svcrdma: Modify the RPC reply path to use FRMR when available
svcrdma: Modify the RPC recv path to use FRMR when available
svcrdma: Add support to svc_rdma_send to handle chained WR
svcrdma: Modify post recv path to use local dma key
svcrdma: Add a service to register a Fast Reg MR with the device
svcrdma: Query device for Fast Reg support during connection setup
svcrdma: Add FRMR get/put services
NLM: Remove unused argument from svc_addsock() function
NLM: Remove "proto" argument from lockd_up()
NLM: Always start both UDP and TCP listeners
lockd: Remove unused fields in the nlm_reboot structure
lockd: Add helper to sanity check incoming NOTIFY requests
lockd: change nlmclnt_grant() to take a "struct sockaddr *"
lockd: Adjust nlmsvc_lookup_host() to accomodate AF_INET6 addresses
lockd: Adjust nlmclnt_lookup_host() signature to accomodate non-AF_INET
lockd: Support non-AF_INET addresses in nlm_lookup_host()
NLM: Convert nlm_lookup_host() to use a single argument
svcrdma: Add Fast Reg MR Data Types
...
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/fs.h | 65 | ||||
-rw-r--r-- | include/linux/lockd/bind.h | 11 | ||||
-rw-r--r-- | include/linux/lockd/lockd.h | 137 | ||||
-rw-r--r-- | include/linux/lockd/xdr.h | 2 | ||||
-rw-r--r-- | include/linux/nfsd/nfsd.h | 3 | ||||
-rw-r--r-- | include/linux/sunrpc/clnt.h | 5 | ||||
-rw-r--r-- | include/linux/sunrpc/svc.h | 19 | ||||
-rw-r--r-- | include/linux/sunrpc/svc_rdma.h | 27 | ||||
-rw-r--r-- | include/linux/sunrpc/svcsock.h | 5 |
9 files changed, 226 insertions, 48 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 44e3cb2f1966..a6a625be13fc 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -947,6 +947,14 @@ struct lock_manager_operations { | |||
947 | int (*fl_change)(struct file_lock **, int); | 947 | int (*fl_change)(struct file_lock **, int); |
948 | }; | 948 | }; |
949 | 949 | ||
950 | struct lock_manager { | ||
951 | struct list_head list; | ||
952 | }; | ||
953 | |||
954 | void locks_start_grace(struct lock_manager *); | ||
955 | void locks_end_grace(struct lock_manager *); | ||
956 | int locks_in_grace(void); | ||
957 | |||
950 | /* that will die - we need it for nfs_lock_info */ | 958 | /* that will die - we need it for nfs_lock_info */ |
951 | #include <linux/nfs_fs_i.h> | 959 | #include <linux/nfs_fs_i.h> |
952 | 960 | ||
@@ -988,6 +996,13 @@ struct file_lock { | |||
988 | 996 | ||
989 | #include <linux/fcntl.h> | 997 | #include <linux/fcntl.h> |
990 | 998 | ||
999 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | ||
1000 | |||
1001 | /* fs/sync.c */ | ||
1002 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | ||
1003 | loff_t endbyte, unsigned int flags); | ||
1004 | |||
1005 | #ifdef CONFIG_FILE_LOCKING | ||
991 | extern int fcntl_getlk(struct file *, struct flock __user *); | 1006 | extern int fcntl_getlk(struct file *, struct flock __user *); |
992 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, | 1007 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, |
993 | struct flock __user *); | 1008 | struct flock __user *); |
@@ -998,14 +1013,9 @@ extern int fcntl_setlk64(unsigned int, struct file *, unsigned int, | |||
998 | struct flock64 __user *); | 1013 | struct flock64 __user *); |
999 | #endif | 1014 | #endif |
1000 | 1015 | ||
1001 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | ||
1002 | extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); | 1016 | extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); |
1003 | extern int fcntl_getlease(struct file *filp); | 1017 | extern int fcntl_getlease(struct file *filp); |
1004 | 1018 | ||
1005 | /* fs/sync.c */ | ||
1006 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | ||
1007 | loff_t endbyte, unsigned int flags); | ||
1008 | |||
1009 | /* fs/locks.c */ | 1019 | /* fs/locks.c */ |
1010 | extern void locks_init_lock(struct file_lock *); | 1020 | extern void locks_init_lock(struct file_lock *); |
1011 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); | 1021 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); |
@@ -1028,6 +1038,37 @@ extern int lease_modify(struct file_lock **, int); | |||
1028 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1038 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
1029 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1039 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
1030 | extern struct seq_operations locks_seq_operations; | 1040 | extern struct seq_operations locks_seq_operations; |
1041 | #else /* !CONFIG_FILE_LOCKING */ | ||
1042 | #define fcntl_getlk(a, b) ({ -EINVAL; }) | ||
1043 | #define fcntl_setlk(a, b, c, d) ({ -EACCES; }) | ||
1044 | #if BITS_PER_LONG == 32 | ||
1045 | #define fcntl_getlk64(a, b) ({ -EINVAL; }) | ||
1046 | #define fcntl_setlk64(a, b, c, d) ({ -EACCES; }) | ||
1047 | #endif | ||
1048 | #define fcntl_setlease(a, b, c) ({ 0; }) | ||
1049 | #define fcntl_getlease(a) ({ 0; }) | ||
1050 | #define locks_init_lock(a) ({ }) | ||
1051 | #define __locks_copy_lock(a, b) ({ }) | ||
1052 | #define locks_copy_lock(a, b) ({ }) | ||
1053 | #define locks_remove_posix(a, b) ({ }) | ||
1054 | #define locks_remove_flock(a) ({ }) | ||
1055 | #define posix_test_lock(a, b) ({ 0; }) | ||
1056 | #define posix_lock_file(a, b, c) ({ -ENOLCK; }) | ||
1057 | #define posix_lock_file_wait(a, b) ({ -ENOLCK; }) | ||
1058 | #define posix_unblock_lock(a, b) (-ENOENT) | ||
1059 | #define vfs_test_lock(a, b) ({ 0; }) | ||
1060 | #define vfs_lock_file(a, b, c, d) (-ENOLCK) | ||
1061 | #define vfs_cancel_lock(a, b) ({ 0; }) | ||
1062 | #define flock_lock_file_wait(a, b) ({ -ENOLCK; }) | ||
1063 | #define __break_lease(a, b) ({ 0; }) | ||
1064 | #define lease_get_mtime(a, b) ({ }) | ||
1065 | #define generic_setlease(a, b, c) ({ -EINVAL; }) | ||
1066 | #define vfs_setlease(a, b, c) ({ -EINVAL; }) | ||
1067 | #define lease_modify(a, b) ({ -EINVAL; }) | ||
1068 | #define lock_may_read(a, b, c) ({ 1; }) | ||
1069 | #define lock_may_write(a, b, c) ({ 1; }) | ||
1070 | #endif /* !CONFIG_FILE_LOCKING */ | ||
1071 | |||
1031 | 1072 | ||
1032 | struct fasync_struct { | 1073 | struct fasync_struct { |
1033 | int magic; | 1074 | int magic; |
@@ -1575,9 +1616,12 @@ extern int vfs_statfs(struct dentry *, struct kstatfs *); | |||
1575 | /* /sys/fs */ | 1616 | /* /sys/fs */ |
1576 | extern struct kobject *fs_kobj; | 1617 | extern struct kobject *fs_kobj; |
1577 | 1618 | ||
1619 | extern int rw_verify_area(int, struct file *, loff_t *, size_t); | ||
1620 | |||
1578 | #define FLOCK_VERIFY_READ 1 | 1621 | #define FLOCK_VERIFY_READ 1 |
1579 | #define FLOCK_VERIFY_WRITE 2 | 1622 | #define FLOCK_VERIFY_WRITE 2 |
1580 | 1623 | ||
1624 | #ifdef CONFIG_FILE_LOCKING | ||
1581 | extern int locks_mandatory_locked(struct inode *); | 1625 | extern int locks_mandatory_locked(struct inode *); |
1582 | extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); | 1626 | extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); |
1583 | 1627 | ||
@@ -1608,8 +1652,6 @@ static inline int locks_verify_locked(struct inode *inode) | |||
1608 | return 0; | 1652 | return 0; |
1609 | } | 1653 | } |
1610 | 1654 | ||
1611 | extern int rw_verify_area(int, struct file *, loff_t *, size_t); | ||
1612 | |||
1613 | static inline int locks_verify_truncate(struct inode *inode, | 1655 | static inline int locks_verify_truncate(struct inode *inode, |
1614 | struct file *filp, | 1656 | struct file *filp, |
1615 | loff_t size) | 1657 | loff_t size) |
@@ -1630,6 +1672,15 @@ static inline int break_lease(struct inode *inode, unsigned int mode) | |||
1630 | return __break_lease(inode, mode); | 1672 | return __break_lease(inode, mode); |
1631 | return 0; | 1673 | return 0; |
1632 | } | 1674 | } |
1675 | #else /* !CONFIG_FILE_LOCKING */ | ||
1676 | #define locks_mandatory_locked(a) ({ 0; }) | ||
1677 | #define locks_mandatory_area(a, b, c, d, e) ({ 0; }) | ||
1678 | #define __mandatory_lock(a) ({ 0; }) | ||
1679 | #define mandatory_lock(a) ({ 0; }) | ||
1680 | #define locks_verify_locked(a) ({ 0; }) | ||
1681 | #define locks_verify_truncate(a, b, c) ({ 0; }) | ||
1682 | #define break_lease(a, b) ({ 0; }) | ||
1683 | #endif /* CONFIG_FILE_LOCKING */ | ||
1633 | 1684 | ||
1634 | /* fs/open.c */ | 1685 | /* fs/open.c */ |
1635 | 1686 | ||
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h index 3d25bcd139d1..e5872dc994c0 100644 --- a/include/linux/lockd/bind.h +++ b/include/linux/lockd/bind.h | |||
@@ -27,7 +27,6 @@ struct nlmsvc_binding { | |||
27 | struct nfs_fh *, | 27 | struct nfs_fh *, |
28 | struct file **); | 28 | struct file **); |
29 | void (*fclose)(struct file *); | 29 | void (*fclose)(struct file *); |
30 | unsigned long (*get_grace_period)(void); | ||
31 | }; | 30 | }; |
32 | 31 | ||
33 | extern struct nlmsvc_binding * nlmsvc_ops; | 32 | extern struct nlmsvc_binding * nlmsvc_ops; |
@@ -53,15 +52,7 @@ extern void nlmclnt_done(struct nlm_host *host); | |||
53 | 52 | ||
54 | extern int nlmclnt_proc(struct nlm_host *host, int cmd, | 53 | extern int nlmclnt_proc(struct nlm_host *host, int cmd, |
55 | struct file_lock *fl); | 54 | struct file_lock *fl); |
56 | extern int lockd_up(int proto); | 55 | extern int lockd_up(void); |
57 | extern void lockd_down(void); | 56 | extern void lockd_down(void); |
58 | 57 | ||
59 | unsigned long get_nfs_grace_period(void); | ||
60 | |||
61 | #ifdef CONFIG_NFSD_V4 | ||
62 | unsigned long get_nfs4_grace_period(void); | ||
63 | #else | ||
64 | static inline unsigned long get_nfs4_grace_period(void) {return 0;} | ||
65 | #endif | ||
66 | |||
67 | #endif /* LINUX_LOCKD_BIND_H */ | 58 | #endif /* LINUX_LOCKD_BIND_H */ |
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index dbb87ab282e8..b56d5aa9b194 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h | |||
@@ -12,6 +12,8 @@ | |||
12 | #ifdef __KERNEL__ | 12 | #ifdef __KERNEL__ |
13 | 13 | ||
14 | #include <linux/in.h> | 14 | #include <linux/in.h> |
15 | #include <linux/in6.h> | ||
16 | #include <net/ipv6.h> | ||
15 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
16 | #include <linux/kref.h> | 18 | #include <linux/kref.h> |
17 | #include <linux/utsname.h> | 19 | #include <linux/utsname.h> |
@@ -38,8 +40,9 @@ | |||
38 | */ | 40 | */ |
39 | struct nlm_host { | 41 | struct nlm_host { |
40 | struct hlist_node h_hash; /* doubly linked list */ | 42 | struct hlist_node h_hash; /* doubly linked list */ |
41 | struct sockaddr_in h_addr; /* peer address */ | 43 | struct sockaddr_storage h_addr; /* peer address */ |
42 | struct sockaddr_in h_saddr; /* our address (optional) */ | 44 | size_t h_addrlen; |
45 | struct sockaddr_storage h_srcaddr; /* our address (optional) */ | ||
43 | struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ | 46 | struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ |
44 | char * h_name; /* remote hostname */ | 47 | char * h_name; /* remote hostname */ |
45 | u32 h_version; /* interface version */ | 48 | u32 h_version; /* interface version */ |
@@ -61,18 +64,56 @@ struct nlm_host { | |||
61 | struct list_head h_granted; /* Locks in GRANTED state */ | 64 | struct list_head h_granted; /* Locks in GRANTED state */ |
62 | struct list_head h_reclaim; /* Locks in RECLAIM state */ | 65 | struct list_head h_reclaim; /* Locks in RECLAIM state */ |
63 | struct nsm_handle * h_nsmhandle; /* NSM status handle */ | 66 | struct nsm_handle * h_nsmhandle; /* NSM status handle */ |
67 | |||
68 | char h_addrbuf[48], /* address eyecatchers */ | ||
69 | h_srcaddrbuf[48]; | ||
64 | }; | 70 | }; |
65 | 71 | ||
66 | struct nsm_handle { | 72 | struct nsm_handle { |
67 | struct list_head sm_link; | 73 | struct list_head sm_link; |
68 | atomic_t sm_count; | 74 | atomic_t sm_count; |
69 | char * sm_name; | 75 | char * sm_name; |
70 | struct sockaddr_in sm_addr; | 76 | struct sockaddr_storage sm_addr; |
77 | size_t sm_addrlen; | ||
71 | unsigned int sm_monitored : 1, | 78 | unsigned int sm_monitored : 1, |
72 | sm_sticky : 1; /* don't unmonitor */ | 79 | sm_sticky : 1; /* don't unmonitor */ |
80 | char sm_addrbuf[48]; /* address eyecatcher */ | ||
73 | }; | 81 | }; |
74 | 82 | ||
75 | /* | 83 | /* |
84 | * Rigorous type checking on sockaddr type conversions | ||
85 | */ | ||
86 | static inline struct sockaddr_in *nlm_addr_in(const struct nlm_host *host) | ||
87 | { | ||
88 | return (struct sockaddr_in *)&host->h_addr; | ||
89 | } | ||
90 | |||
91 | static inline struct sockaddr *nlm_addr(const struct nlm_host *host) | ||
92 | { | ||
93 | return (struct sockaddr *)&host->h_addr; | ||
94 | } | ||
95 | |||
96 | static inline struct sockaddr_in *nlm_srcaddr_in(const struct nlm_host *host) | ||
97 | { | ||
98 | return (struct sockaddr_in *)&host->h_srcaddr; | ||
99 | } | ||
100 | |||
101 | static inline struct sockaddr *nlm_srcaddr(const struct nlm_host *host) | ||
102 | { | ||
103 | return (struct sockaddr *)&host->h_srcaddr; | ||
104 | } | ||
105 | |||
106 | static inline struct sockaddr_in *nsm_addr_in(const struct nsm_handle *handle) | ||
107 | { | ||
108 | return (struct sockaddr_in *)&handle->sm_addr; | ||
109 | } | ||
110 | |||
111 | static inline struct sockaddr *nsm_addr(const struct nsm_handle *handle) | ||
112 | { | ||
113 | return (struct sockaddr *)&handle->sm_addr; | ||
114 | } | ||
115 | |||
116 | /* | ||
76 | * Map an fl_owner_t into a unique 32-bit "pid" | 117 | * Map an fl_owner_t into a unique 32-bit "pid" |
77 | */ | 118 | */ |
78 | struct nlm_lockowner { | 119 | struct nlm_lockowner { |
@@ -166,7 +207,8 @@ int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *); | |||
166 | struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl); | 207 | struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl); |
167 | void nlmclnt_finish_block(struct nlm_wait *block); | 208 | void nlmclnt_finish_block(struct nlm_wait *block); |
168 | int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); | 209 | int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); |
169 | __be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *); | 210 | __be32 nlmclnt_grant(const struct sockaddr *addr, |
211 | const struct nlm_lock *lock); | ||
170 | void nlmclnt_recovery(struct nlm_host *); | 212 | void nlmclnt_recovery(struct nlm_host *); |
171 | int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); | 213 | int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); |
172 | void nlmclnt_next_cookie(struct nlm_cookie *); | 214 | void nlmclnt_next_cookie(struct nlm_cookie *); |
@@ -174,12 +216,14 @@ void nlmclnt_next_cookie(struct nlm_cookie *); | |||
174 | /* | 216 | /* |
175 | * Host cache | 217 | * Host cache |
176 | */ | 218 | */ |
177 | struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *sin, | 219 | struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap, |
178 | int proto, u32 version, | 220 | const size_t salen, |
221 | const unsigned short protocol, | ||
222 | const u32 version, | ||
223 | const char *hostname); | ||
224 | struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, | ||
179 | const char *hostname, | 225 | const char *hostname, |
180 | unsigned int hostname_len); | 226 | const size_t hostname_len); |
181 | struct nlm_host *nlmsvc_lookup_host(struct svc_rqst *, const char *, | ||
182 | unsigned int); | ||
183 | struct rpc_clnt * nlm_bind_host(struct nlm_host *); | 227 | struct rpc_clnt * nlm_bind_host(struct nlm_host *); |
184 | void nlm_rebind_host(struct nlm_host *); | 228 | void nlm_rebind_host(struct nlm_host *); |
185 | struct nlm_host * nlm_get_host(struct nlm_host *); | 229 | struct nlm_host * nlm_get_host(struct nlm_host *); |
@@ -201,7 +245,7 @@ typedef int (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref); | |||
201 | */ | 245 | */ |
202 | __be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, | 246 | __be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, |
203 | struct nlm_host *, struct nlm_lock *, int, | 247 | struct nlm_host *, struct nlm_lock *, int, |
204 | struct nlm_cookie *); | 248 | struct nlm_cookie *, int); |
205 | __be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); | 249 | __be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); |
206 | __be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *, | 250 | __be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *, |
207 | struct nlm_host *, struct nlm_lock *, | 251 | struct nlm_host *, struct nlm_lock *, |
@@ -233,15 +277,82 @@ static inline struct inode *nlmsvc_file_inode(struct nlm_file *file) | |||
233 | return file->f_file->f_path.dentry->d_inode; | 277 | return file->f_file->f_path.dentry->d_inode; |
234 | } | 278 | } |
235 | 279 | ||
280 | static inline int __nlm_privileged_request4(const struct sockaddr *sap) | ||
281 | { | ||
282 | const struct sockaddr_in *sin = (struct sockaddr_in *)sap; | ||
283 | return (sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) && | ||
284 | (ntohs(sin->sin_port) < 1024); | ||
285 | } | ||
286 | |||
287 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
288 | static inline int __nlm_privileged_request6(const struct sockaddr *sap) | ||
289 | { | ||
290 | const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap; | ||
291 | return (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK) && | ||
292 | (ntohs(sin6->sin6_port) < 1024); | ||
293 | } | ||
294 | #else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | ||
295 | static inline int __nlm_privileged_request6(const struct sockaddr *sap) | ||
296 | { | ||
297 | return 0; | ||
298 | } | ||
299 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | ||
300 | |||
236 | /* | 301 | /* |
237 | * Compare two host addresses (needs modifying for ipv6) | 302 | * Ensure incoming requests are from local privileged callers. |
303 | * | ||
304 | * Return TRUE if sender is local and is connecting via a privileged port; | ||
305 | * otherwise return FALSE. | ||
238 | */ | 306 | */ |
239 | static inline int nlm_cmp_addr(const struct sockaddr_in *sin1, | 307 | static inline int nlm_privileged_requester(const struct svc_rqst *rqstp) |
240 | const struct sockaddr_in *sin2) | ||
241 | { | 308 | { |
309 | const struct sockaddr *sap = svc_addr(rqstp); | ||
310 | |||
311 | switch (sap->sa_family) { | ||
312 | case AF_INET: | ||
313 | return __nlm_privileged_request4(sap); | ||
314 | case AF_INET6: | ||
315 | return __nlm_privileged_request6(sap); | ||
316 | default: | ||
317 | return 0; | ||
318 | } | ||
319 | } | ||
320 | |||
321 | static inline int __nlm_cmp_addr4(const struct sockaddr *sap1, | ||
322 | const struct sockaddr *sap2) | ||
323 | { | ||
324 | const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1; | ||
325 | const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2; | ||
242 | return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; | 326 | return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; |
243 | } | 327 | } |
244 | 328 | ||
329 | static inline int __nlm_cmp_addr6(const struct sockaddr *sap1, | ||
330 | const struct sockaddr *sap2) | ||
331 | { | ||
332 | const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1; | ||
333 | const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2; | ||
334 | return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr); | ||
335 | } | ||
336 | |||
337 | /* | ||
338 | * Compare two host addresses | ||
339 | * | ||
340 | * Return TRUE if the addresses are the same; otherwise FALSE. | ||
341 | */ | ||
342 | static inline int nlm_cmp_addr(const struct sockaddr *sap1, | ||
343 | const struct sockaddr *sap2) | ||
344 | { | ||
345 | if (sap1->sa_family == sap2->sa_family) { | ||
346 | switch (sap1->sa_family) { | ||
347 | case AF_INET: | ||
348 | return __nlm_cmp_addr4(sap1, sap2); | ||
349 | case AF_INET6: | ||
350 | return __nlm_cmp_addr6(sap1, sap2); | ||
351 | } | ||
352 | } | ||
353 | return 0; | ||
354 | } | ||
355 | |||
245 | /* | 356 | /* |
246 | * Compare two NLM locks. | 357 | * Compare two NLM locks. |
247 | * When the second lock is of type F_UNLCK, this acts like a wildcard. | 358 | * When the second lock is of type F_UNLCK, this acts like a wildcard. |
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h index df18fa053bcd..d6b3a802c046 100644 --- a/include/linux/lockd/xdr.h +++ b/include/linux/lockd/xdr.h | |||
@@ -81,8 +81,6 @@ struct nlm_reboot { | |||
81 | unsigned int len; | 81 | unsigned int len; |
82 | u32 state; | 82 | u32 state; |
83 | __be32 addr; | 83 | __be32 addr; |
84 | __be32 vers; | ||
85 | __be32 proto; | ||
86 | }; | 84 | }; |
87 | 85 | ||
88 | /* | 86 | /* |
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 108f47e5fd95..21269405ffe2 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h | |||
@@ -38,6 +38,7 @@ | |||
38 | #define NFSD_MAY_LOCK 32 | 38 | #define NFSD_MAY_LOCK 32 |
39 | #define NFSD_MAY_OWNER_OVERRIDE 64 | 39 | #define NFSD_MAY_OWNER_OVERRIDE 64 |
40 | #define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ | 40 | #define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ |
41 | #define NFSD_MAY_BYPASS_GSS_ON_ROOT 256 | ||
41 | 42 | ||
42 | #define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) | 43 | #define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) |
43 | #define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) | 44 | #define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) |
@@ -125,7 +126,7 @@ int nfsd_truncate(struct svc_rqst *, struct svc_fh *, | |||
125 | __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, | 126 | __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, |
126 | loff_t *, struct readdir_cd *, filldir_t); | 127 | loff_t *, struct readdir_cd *, filldir_t); |
127 | __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, | 128 | __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, |
128 | struct kstatfs *); | 129 | struct kstatfs *, int access); |
129 | 130 | ||
130 | int nfsd_notify_change(struct inode *, struct iattr *); | 131 | int nfsd_notify_change(struct inode *, struct iattr *); |
131 | __be32 nfsd_permission(struct svc_rqst *, struct svc_export *, | 132 | __be32 nfsd_permission(struct svc_rqst *, struct svc_export *, |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index e5bfe01ee305..6f0ee1b84a4f 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -104,6 +104,7 @@ struct rpc_create_args { | |||
104 | const struct rpc_timeout *timeout; | 104 | const struct rpc_timeout *timeout; |
105 | char *servername; | 105 | char *servername; |
106 | struct rpc_program *program; | 106 | struct rpc_program *program; |
107 | u32 prognumber; /* overrides program->number */ | ||
107 | u32 version; | 108 | u32 version; |
108 | rpc_authflavor_t authflavor; | 109 | rpc_authflavor_t authflavor; |
109 | unsigned long flags; | 110 | unsigned long flags; |
@@ -124,10 +125,10 @@ struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); | |||
124 | void rpc_shutdown_client(struct rpc_clnt *); | 125 | void rpc_shutdown_client(struct rpc_clnt *); |
125 | void rpc_release_client(struct rpc_clnt *); | 126 | void rpc_release_client(struct rpc_clnt *); |
126 | 127 | ||
127 | int rpcb_register(u32, u32, int, unsigned short, int *); | 128 | int rpcb_register(u32, u32, int, unsigned short); |
128 | int rpcb_v4_register(const u32 program, const u32 version, | 129 | int rpcb_v4_register(const u32 program, const u32 version, |
129 | const struct sockaddr *address, | 130 | const struct sockaddr *address, |
130 | const char *netid, int *result); | 131 | const char *netid); |
131 | int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int); | 132 | int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int); |
132 | void rpcb_getport_async(struct rpc_task *); | 133 | void rpcb_getport_async(struct rpc_task *); |
133 | 134 | ||
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index dc69068d94c7..3afe7fb403b2 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -66,6 +66,7 @@ struct svc_serv { | |||
66 | struct list_head sv_tempsocks; /* all temporary sockets */ | 66 | struct list_head sv_tempsocks; /* all temporary sockets */ |
67 | int sv_tmpcnt; /* count of temporary sockets */ | 67 | int sv_tmpcnt; /* count of temporary sockets */ |
68 | struct timer_list sv_temptimer; /* timer for aging temporary sockets */ | 68 | struct timer_list sv_temptimer; /* timer for aging temporary sockets */ |
69 | sa_family_t sv_family; /* listener's address family */ | ||
69 | 70 | ||
70 | char * sv_name; /* service name */ | 71 | char * sv_name; /* service name */ |
71 | 72 | ||
@@ -265,17 +266,17 @@ struct svc_rqst { | |||
265 | /* | 266 | /* |
266 | * Rigorous type checking on sockaddr type conversions | 267 | * Rigorous type checking on sockaddr type conversions |
267 | */ | 268 | */ |
268 | static inline struct sockaddr_in *svc_addr_in(struct svc_rqst *rqst) | 269 | static inline struct sockaddr_in *svc_addr_in(const struct svc_rqst *rqst) |
269 | { | 270 | { |
270 | return (struct sockaddr_in *) &rqst->rq_addr; | 271 | return (struct sockaddr_in *) &rqst->rq_addr; |
271 | } | 272 | } |
272 | 273 | ||
273 | static inline struct sockaddr_in6 *svc_addr_in6(struct svc_rqst *rqst) | 274 | static inline struct sockaddr_in6 *svc_addr_in6(const struct svc_rqst *rqst) |
274 | { | 275 | { |
275 | return (struct sockaddr_in6 *) &rqst->rq_addr; | 276 | return (struct sockaddr_in6 *) &rqst->rq_addr; |
276 | } | 277 | } |
277 | 278 | ||
278 | static inline struct sockaddr *svc_addr(struct svc_rqst *rqst) | 279 | static inline struct sockaddr *svc_addr(const struct svc_rqst *rqst) |
279 | { | 280 | { |
280 | return (struct sockaddr *) &rqst->rq_addr; | 281 | return (struct sockaddr *) &rqst->rq_addr; |
281 | } | 282 | } |
@@ -381,18 +382,20 @@ struct svc_procedure { | |||
381 | /* | 382 | /* |
382 | * Function prototypes. | 383 | * Function prototypes. |
383 | */ | 384 | */ |
384 | struct svc_serv * svc_create(struct svc_program *, unsigned int, | 385 | struct svc_serv *svc_create(struct svc_program *, unsigned int, sa_family_t, |
385 | void (*shutdown)(struct svc_serv*)); | 386 | void (*shutdown)(struct svc_serv *)); |
386 | struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, | 387 | struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, |
387 | struct svc_pool *pool); | 388 | struct svc_pool *pool); |
388 | void svc_exit_thread(struct svc_rqst *); | 389 | void svc_exit_thread(struct svc_rqst *); |
389 | struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, | 390 | struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, |
390 | void (*shutdown)(struct svc_serv*), svc_thread_fn, | 391 | sa_family_t, void (*shutdown)(struct svc_serv *), |
391 | struct module *); | 392 | svc_thread_fn, struct module *); |
392 | int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); | 393 | int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); |
393 | void svc_destroy(struct svc_serv *); | 394 | void svc_destroy(struct svc_serv *); |
394 | int svc_process(struct svc_rqst *); | 395 | int svc_process(struct svc_rqst *); |
395 | int svc_register(struct svc_serv *, int, unsigned short); | 396 | int svc_register(const struct svc_serv *, const unsigned short, |
397 | const unsigned short); | ||
398 | |||
396 | void svc_wake_up(struct svc_serv *); | 399 | void svc_wake_up(struct svc_serv *); |
397 | void svc_reserve(struct svc_rqst *rqstp, int space); | 400 | void svc_reserve(struct svc_rqst *rqstp, int space); |
398 | struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); | 401 | struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); |
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h index dc05b54bd3a3..c14fe86dac59 100644 --- a/include/linux/sunrpc/svc_rdma.h +++ b/include/linux/sunrpc/svc_rdma.h | |||
@@ -72,6 +72,7 @@ extern atomic_t rdma_stat_sq_prod; | |||
72 | */ | 72 | */ |
73 | struct svc_rdma_op_ctxt { | 73 | struct svc_rdma_op_ctxt { |
74 | struct svc_rdma_op_ctxt *read_hdr; | 74 | struct svc_rdma_op_ctxt *read_hdr; |
75 | struct svc_rdma_fastreg_mr *frmr; | ||
75 | int hdr_count; | 76 | int hdr_count; |
76 | struct xdr_buf arg; | 77 | struct xdr_buf arg; |
77 | struct list_head dto_q; | 78 | struct list_head dto_q; |
@@ -103,16 +104,30 @@ struct svc_rdma_chunk_sge { | |||
103 | int start; /* sge no for this chunk */ | 104 | int start; /* sge no for this chunk */ |
104 | int count; /* sge count for this chunk */ | 105 | int count; /* sge count for this chunk */ |
105 | }; | 106 | }; |
107 | struct svc_rdma_fastreg_mr { | ||
108 | struct ib_mr *mr; | ||
109 | void *kva; | ||
110 | struct ib_fast_reg_page_list *page_list; | ||
111 | int page_list_len; | ||
112 | unsigned long access_flags; | ||
113 | unsigned long map_len; | ||
114 | enum dma_data_direction direction; | ||
115 | struct list_head frmr_list; | ||
116 | }; | ||
106 | struct svc_rdma_req_map { | 117 | struct svc_rdma_req_map { |
118 | struct svc_rdma_fastreg_mr *frmr; | ||
107 | unsigned long count; | 119 | unsigned long count; |
108 | union { | 120 | union { |
109 | struct kvec sge[RPCSVC_MAXPAGES]; | 121 | struct kvec sge[RPCSVC_MAXPAGES]; |
110 | struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES]; | 122 | struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES]; |
111 | }; | 123 | }; |
112 | }; | 124 | }; |
113 | 125 | #define RDMACTXT_F_FAST_UNREG 1 | |
114 | #define RDMACTXT_F_LAST_CTXT 2 | 126 | #define RDMACTXT_F_LAST_CTXT 2 |
115 | 127 | ||
128 | #define SVCRDMA_DEVCAP_FAST_REG 1 /* fast mr registration */ | ||
129 | #define SVCRDMA_DEVCAP_READ_W_INV 2 /* read w/ invalidate */ | ||
130 | |||
116 | struct svcxprt_rdma { | 131 | struct svcxprt_rdma { |
117 | struct svc_xprt sc_xprt; /* SVC transport structure */ | 132 | struct svc_xprt sc_xprt; /* SVC transport structure */ |
118 | struct rdma_cm_id *sc_cm_id; /* RDMA connection id */ | 133 | struct rdma_cm_id *sc_cm_id; /* RDMA connection id */ |
@@ -136,6 +151,11 @@ struct svcxprt_rdma { | |||
136 | struct ib_cq *sc_rq_cq; | 151 | struct ib_cq *sc_rq_cq; |
137 | struct ib_cq *sc_sq_cq; | 152 | struct ib_cq *sc_sq_cq; |
138 | struct ib_mr *sc_phys_mr; /* MR for server memory */ | 153 | struct ib_mr *sc_phys_mr; /* MR for server memory */ |
154 | u32 sc_dev_caps; /* distilled device caps */ | ||
155 | u32 sc_dma_lkey; /* local dma key */ | ||
156 | unsigned int sc_frmr_pg_list_len; | ||
157 | struct list_head sc_frmr_q; | ||
158 | spinlock_t sc_frmr_q_lock; | ||
139 | 159 | ||
140 | spinlock_t sc_lock; /* transport lock */ | 160 | spinlock_t sc_lock; /* transport lock */ |
141 | 161 | ||
@@ -192,8 +212,13 @@ extern int svc_rdma_post_recv(struct svcxprt_rdma *); | |||
192 | extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *); | 212 | extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *); |
193 | extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *); | 213 | extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *); |
194 | extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int); | 214 | extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int); |
215 | extern void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt); | ||
195 | extern struct svc_rdma_req_map *svc_rdma_get_req_map(void); | 216 | extern struct svc_rdma_req_map *svc_rdma_get_req_map(void); |
196 | extern void svc_rdma_put_req_map(struct svc_rdma_req_map *); | 217 | extern void svc_rdma_put_req_map(struct svc_rdma_req_map *); |
218 | extern int svc_rdma_fastreg(struct svcxprt_rdma *, struct svc_rdma_fastreg_mr *); | ||
219 | extern struct svc_rdma_fastreg_mr *svc_rdma_get_frmr(struct svcxprt_rdma *); | ||
220 | extern void svc_rdma_put_frmr(struct svcxprt_rdma *, | ||
221 | struct svc_rdma_fastreg_mr *); | ||
197 | extern void svc_sq_reap(struct svcxprt_rdma *); | 222 | extern void svc_sq_reap(struct svcxprt_rdma *); |
198 | extern void svc_rq_reap(struct svcxprt_rdma *); | 223 | extern void svc_rq_reap(struct svcxprt_rdma *); |
199 | extern struct svc_xprt_class svc_rdma_class; | 224 | extern struct svc_xprt_class svc_rdma_class; |
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index 8cff696dedf5..483e10380aae 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h | |||
@@ -39,10 +39,7 @@ int svc_send(struct svc_rqst *); | |||
39 | void svc_drop(struct svc_rqst *); | 39 | void svc_drop(struct svc_rqst *); |
40 | void svc_sock_update_bufs(struct svc_serv *serv); | 40 | void svc_sock_update_bufs(struct svc_serv *serv); |
41 | int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose); | 41 | int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose); |
42 | int svc_addsock(struct svc_serv *serv, | 42 | int svc_addsock(struct svc_serv *serv, int fd, char *name_return); |
43 | int fd, | ||
44 | char *name_return, | ||
45 | int *proto); | ||
46 | void svc_init_xprt_sock(void); | 43 | void svc_init_xprt_sock(void); |
47 | void svc_cleanup_xprt_sock(void); | 44 | void svc_cleanup_xprt_sock(void); |
48 | 45 | ||