diff options
author | James Morris <jmorris@namei.org> | 2009-02-05 19:01:45 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-02-05 19:01:45 -0500 |
commit | cb5629b10d64a8006622ce3a52bc887d91057d69 (patch) | |
tree | 7c06d8f30783115e3384721046258ce615b129c5 /fs/lockd/svc.c | |
parent | 8920d5ad6ba74ae8ab020e90cc4d976980e68701 (diff) | |
parent | f01d1d546abb2f4028b5299092f529eefb01253a (diff) |
Merge branch 'master' into next
Conflicts:
fs/namei.c
Manually merged per:
diff --cc fs/namei.c
index 734f2b5,bbc15c2..0000000
--- a/fs/namei.c
+++ b/fs/namei.c
@@@ -860,9 -848,8 +849,10 @@@ static int __link_path_walk(const char
nd->flags |= LOOKUP_CONTINUE;
err = exec_permission_lite(inode);
if (err == -EAGAIN)
- err = vfs_permission(nd, MAY_EXEC);
+ err = inode_permission(nd->path.dentry->d_inode,
+ MAY_EXEC);
+ if (!err)
+ err = ima_path_check(&nd->path, MAY_EXEC);
if (err)
break;
@@@ -1525,14 -1506,9 +1509,14 @@@ int may_open(struct path *path, int acc
flag &= ~O_TRUNC;
}
- error = vfs_permission(nd, acc_mode);
+ error = inode_permission(inode, acc_mode);
if (error)
return error;
+
- error = ima_path_check(&nd->path,
++ error = ima_path_check(path,
+ acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC));
+ if (error)
+ return error;
/*
* An append-only file must be opened in append mode for writing.
*/
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'fs/lockd/svc.c')
-rw-r--r-- | fs/lockd/svc.c | 72 |
1 files changed, 48 insertions, 24 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 252d80163d02..64f1c31b5853 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/sunrpc/svcsock.h> | 35 | #include <linux/sunrpc/svcsock.h> |
36 | #include <net/ip.h> | 36 | #include <net/ip.h> |
37 | #include <linux/lockd/lockd.h> | 37 | #include <linux/lockd/lockd.h> |
38 | #include <linux/lockd/sm_inter.h> | ||
39 | #include <linux/nfs.h> | 38 | #include <linux/nfs.h> |
40 | 39 | ||
41 | #define NLMDBG_FACILITY NLMDBG_SVC | 40 | #define NLMDBG_FACILITY NLMDBG_SVC |
@@ -54,13 +53,26 @@ static struct svc_rqst *nlmsvc_rqst; | |||
54 | unsigned long nlmsvc_timeout; | 53 | unsigned long nlmsvc_timeout; |
55 | 54 | ||
56 | /* | 55 | /* |
56 | * If the kernel has IPv6 support available, always listen for | ||
57 | * both AF_INET and AF_INET6 requests. | ||
58 | */ | ||
59 | #if (defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)) && \ | ||
60 | defined(CONFIG_SUNRPC_REGISTER_V4) | ||
61 | static const sa_family_t nlmsvc_family = AF_INET6; | ||
62 | #else /* (CONFIG_IPV6 || CONFIG_IPV6_MODULE) && CONFIG_SUNRPC_REGISTER_V4 */ | ||
63 | static const sa_family_t nlmsvc_family = AF_INET; | ||
64 | #endif /* (CONFIG_IPV6 || CONFIG_IPV6_MODULE) && CONFIG_SUNRPC_REGISTER_V4 */ | ||
65 | |||
66 | /* | ||
57 | * These can be set at insmod time (useful for NFS as root filesystem), | 67 | * These can be set at insmod time (useful for NFS as root filesystem), |
58 | * and also changed through the sysctl interface. -- Jamie Lokier, Aug 2003 | 68 | * and also changed through the sysctl interface. -- Jamie Lokier, Aug 2003 |
59 | */ | 69 | */ |
60 | static unsigned long nlm_grace_period; | 70 | static unsigned long nlm_grace_period; |
61 | static unsigned long nlm_timeout = LOCKD_DFLT_TIMEO; | 71 | static unsigned long nlm_timeout = LOCKD_DFLT_TIMEO; |
62 | static int nlm_udpport, nlm_tcpport; | 72 | static int nlm_udpport, nlm_tcpport; |
63 | int nsm_use_hostnames = 0; | 73 | |
74 | /* RLIM_NOFILE defaults to 1024. That seems like a reasonable default here. */ | ||
75 | static unsigned int nlm_max_connections = 1024; | ||
64 | 76 | ||
65 | /* | 77 | /* |
66 | * Constants needed for the sysctl interface. | 78 | * Constants needed for the sysctl interface. |
@@ -143,6 +155,9 @@ lockd(void *vrqstp) | |||
143 | long timeout = MAX_SCHEDULE_TIMEOUT; | 155 | long timeout = MAX_SCHEDULE_TIMEOUT; |
144 | RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); | 156 | RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); |
145 | 157 | ||
158 | /* update sv_maxconn if it has changed */ | ||
159 | rqstp->rq_server->sv_maxconn = nlm_max_connections; | ||
160 | |||
146 | if (signalled()) { | 161 | if (signalled()) { |
147 | flush_signals(current); | 162 | flush_signals(current); |
148 | if (nlmsvc_ops) { | 163 | if (nlmsvc_ops) { |
@@ -189,6 +204,19 @@ lockd(void *vrqstp) | |||
189 | return 0; | 204 | return 0; |
190 | } | 205 | } |
191 | 206 | ||
207 | static int create_lockd_listener(struct svc_serv *serv, char *name, | ||
208 | unsigned short port) | ||
209 | { | ||
210 | struct svc_xprt *xprt; | ||
211 | |||
212 | xprt = svc_find_xprt(serv, name, 0, 0); | ||
213 | if (xprt == NULL) | ||
214 | return svc_create_xprt(serv, name, port, SVC_SOCK_DEFAULTS); | ||
215 | |||
216 | svc_xprt_put(xprt); | ||
217 | return 0; | ||
218 | } | ||
219 | |||
192 | /* | 220 | /* |
193 | * Ensure there are active UDP and TCP listeners for lockd. | 221 | * Ensure there are active UDP and TCP listeners for lockd. |
194 | * | 222 | * |
@@ -202,29 +230,23 @@ lockd(void *vrqstp) | |||
202 | static int make_socks(struct svc_serv *serv) | 230 | static int make_socks(struct svc_serv *serv) |
203 | { | 231 | { |
204 | static int warned; | 232 | static int warned; |
205 | struct svc_xprt *xprt; | 233 | int err; |
206 | int err = 0; | ||
207 | 234 | ||
208 | xprt = svc_find_xprt(serv, "udp", 0, 0); | 235 | err = create_lockd_listener(serv, "udp", nlm_udpport); |
209 | if (!xprt) | 236 | if (err < 0) |
210 | err = svc_create_xprt(serv, "udp", nlm_udpport, | 237 | goto out_err; |
211 | SVC_SOCK_DEFAULTS); | 238 | |
212 | else | 239 | err = create_lockd_listener(serv, "tcp", nlm_tcpport); |
213 | svc_xprt_put(xprt); | 240 | if (err < 0) |
214 | if (err >= 0) { | 241 | goto out_err; |
215 | xprt = svc_find_xprt(serv, "tcp", 0, 0); | 242 | |
216 | if (!xprt) | 243 | warned = 0; |
217 | err = svc_create_xprt(serv, "tcp", nlm_tcpport, | 244 | return 0; |
218 | SVC_SOCK_DEFAULTS); | 245 | |
219 | else | 246 | out_err: |
220 | svc_xprt_put(xprt); | 247 | if (warned++ == 0) |
221 | } | ||
222 | if (err >= 0) { | ||
223 | warned = 0; | ||
224 | err = 0; | ||
225 | } else if (warned++ == 0) | ||
226 | printk(KERN_WARNING | 248 | printk(KERN_WARNING |
227 | "lockd_up: makesock failed, error=%d\n", err); | 249 | "lockd_up: makesock failed, error=%d\n", err); |
228 | return err; | 250 | return err; |
229 | } | 251 | } |
230 | 252 | ||
@@ -252,7 +274,7 @@ int lockd_up(void) | |||
252 | "lockd_up: no pid, %d users??\n", nlmsvc_users); | 274 | "lockd_up: no pid, %d users??\n", nlmsvc_users); |
253 | 275 | ||
254 | error = -ENOMEM; | 276 | error = -ENOMEM; |
255 | serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, AF_INET, NULL); | 277 | serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, nlmsvc_family, NULL); |
256 | if (!serv) { | 278 | if (!serv) { |
257 | printk(KERN_WARNING "lockd_up: create service failed\n"); | 279 | printk(KERN_WARNING "lockd_up: create service failed\n"); |
258 | goto out; | 280 | goto out; |
@@ -276,6 +298,7 @@ int lockd_up(void) | |||
276 | } | 298 | } |
277 | 299 | ||
278 | svc_sock_update_bufs(serv); | 300 | svc_sock_update_bufs(serv); |
301 | serv->sv_maxconn = nlm_max_connections; | ||
279 | 302 | ||
280 | nlmsvc_task = kthread_run(lockd, nlmsvc_rqst, serv->sv_name); | 303 | nlmsvc_task = kthread_run(lockd, nlmsvc_rqst, serv->sv_name); |
281 | if (IS_ERR(nlmsvc_task)) { | 304 | if (IS_ERR(nlmsvc_task)) { |
@@ -485,6 +508,7 @@ module_param_call(nlm_udpport, param_set_port, param_get_int, | |||
485 | module_param_call(nlm_tcpport, param_set_port, param_get_int, | 508 | module_param_call(nlm_tcpport, param_set_port, param_get_int, |
486 | &nlm_tcpport, 0644); | 509 | &nlm_tcpport, 0644); |
487 | module_param(nsm_use_hostnames, bool, 0644); | 510 | module_param(nsm_use_hostnames, bool, 0644); |
511 | module_param(nlm_max_connections, uint, 0644); | ||
488 | 512 | ||
489 | /* | 513 | /* |
490 | * Initialising and terminating the module. | 514 | * Initialising and terminating the module. |