diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-11-02 23:56:40 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-11-02 23:56:40 -0400 |
commit | 31cbecb4ab538f433145bc5a46f3bea9b9627031 (patch) | |
tree | d6206d42dea7298f7ef05fd1f7bf474245f0d43a /net/sunrpc | |
parent | 2b72c9ccd22c4a3299e5a358dcd639fb253730f4 (diff) | |
parent | 278c023a99b0d6b471d0f4a79835c703482e29ac (diff) |
Merge branch 'osd-devel' into nfs-for-next
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 4 | ||||
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 3 | ||||
-rw-r--r-- | net/sunrpc/svc.c | 38 | ||||
-rw-r--r-- | net/sunrpc/svc_xprt.c | 13 | ||||
-rw-r--r-- | net/sunrpc/svcsock.c | 23 |
5 files changed, 50 insertions, 31 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index e9b76939268d..afb56553dfe7 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -122,7 +122,7 @@ gss_cred_set_ctx(struct rpc_cred *cred, struct gss_cl_ctx *ctx) | |||
122 | if (!test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags)) | 122 | if (!test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags)) |
123 | return; | 123 | return; |
124 | gss_get_ctx(ctx); | 124 | gss_get_ctx(ctx); |
125 | rcu_assign_pointer(gss_cred->gc_ctx, ctx); | 125 | RCU_INIT_POINTER(gss_cred->gc_ctx, ctx); |
126 | set_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags); | 126 | set_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags); |
127 | smp_mb__before_clear_bit(); | 127 | smp_mb__before_clear_bit(); |
128 | clear_bit(RPCAUTH_CRED_NEW, &cred->cr_flags); | 128 | clear_bit(RPCAUTH_CRED_NEW, &cred->cr_flags); |
@@ -950,7 +950,7 @@ gss_destroy_nullcred(struct rpc_cred *cred) | |||
950 | struct gss_auth *gss_auth = container_of(cred->cr_auth, struct gss_auth, rpc_auth); | 950 | struct gss_auth *gss_auth = container_of(cred->cr_auth, struct gss_auth, rpc_auth); |
951 | struct gss_cl_ctx *ctx = gss_cred->gc_ctx; | 951 | struct gss_cl_ctx *ctx = gss_cred->gc_ctx; |
952 | 952 | ||
953 | rcu_assign_pointer(gss_cred->gc_ctx, NULL); | 953 | RCU_INIT_POINTER(gss_cred->gc_ctx, NULL); |
954 | call_rcu(&cred->cr_rcu, gss_free_cred_callback); | 954 | call_rcu(&cred->cr_rcu, gss_free_cred_callback); |
955 | if (ctx) | 955 | if (ctx) |
956 | gss_put_ctx(ctx); | 956 | gss_put_ctx(ctx); |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 67dbc1884383..bfddd68b31d3 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -1104,3 +1104,6 @@ void unregister_rpc_pipefs(void) | |||
1104 | kmem_cache_destroy(rpc_inode_cachep); | 1104 | kmem_cache_destroy(rpc_inode_cachep); |
1105 | unregister_filesystem(&rpc_pipe_fs_type); | 1105 | unregister_filesystem(&rpc_pipe_fs_type); |
1106 | } | 1106 | } |
1107 | |||
1108 | /* Make 'mount -t rpc_pipefs ...' autoload this module. */ | ||
1109 | MODULE_ALIAS("rpc_pipefs"); | ||
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 252552a685dc..6e038884ae0c 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -295,6 +295,18 @@ svc_pool_map_put(void) | |||
295 | } | 295 | } |
296 | 296 | ||
297 | 297 | ||
298 | static int svc_pool_map_get_node(unsigned int pidx) | ||
299 | { | ||
300 | const struct svc_pool_map *m = &svc_pool_map; | ||
301 | |||
302 | if (m->count) { | ||
303 | if (m->mode == SVC_POOL_PERCPU) | ||
304 | return cpu_to_node(m->pool_to[pidx]); | ||
305 | if (m->mode == SVC_POOL_PERNODE) | ||
306 | return m->pool_to[pidx]; | ||
307 | } | ||
308 | return NUMA_NO_NODE; | ||
309 | } | ||
298 | /* | 310 | /* |
299 | * Set the given thread's cpus_allowed mask so that it | 311 | * Set the given thread's cpus_allowed mask so that it |
300 | * will only run on cpus in the given pool. | 312 | * will only run on cpus in the given pool. |
@@ -541,7 +553,7 @@ EXPORT_SYMBOL_GPL(svc_destroy); | |||
541 | * We allocate pages and place them in rq_argpages. | 553 | * We allocate pages and place them in rq_argpages. |
542 | */ | 554 | */ |
543 | static int | 555 | static int |
544 | svc_init_buffer(struct svc_rqst *rqstp, unsigned int size) | 556 | svc_init_buffer(struct svc_rqst *rqstp, unsigned int size, int node) |
545 | { | 557 | { |
546 | unsigned int pages, arghi; | 558 | unsigned int pages, arghi; |
547 | 559 | ||
@@ -555,7 +567,7 @@ svc_init_buffer(struct svc_rqst *rqstp, unsigned int size) | |||
555 | arghi = 0; | 567 | arghi = 0; |
556 | BUG_ON(pages > RPCSVC_MAXPAGES); | 568 | BUG_ON(pages > RPCSVC_MAXPAGES); |
557 | while (pages) { | 569 | while (pages) { |
558 | struct page *p = alloc_page(GFP_KERNEL); | 570 | struct page *p = alloc_pages_node(node, GFP_KERNEL, 0); |
559 | if (!p) | 571 | if (!p) |
560 | break; | 572 | break; |
561 | rqstp->rq_pages[arghi++] = p; | 573 | rqstp->rq_pages[arghi++] = p; |
@@ -578,11 +590,11 @@ svc_release_buffer(struct svc_rqst *rqstp) | |||
578 | } | 590 | } |
579 | 591 | ||
580 | struct svc_rqst * | 592 | struct svc_rqst * |
581 | svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool) | 593 | svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool, int node) |
582 | { | 594 | { |
583 | struct svc_rqst *rqstp; | 595 | struct svc_rqst *rqstp; |
584 | 596 | ||
585 | rqstp = kzalloc(sizeof(*rqstp), GFP_KERNEL); | 597 | rqstp = kzalloc_node(sizeof(*rqstp), GFP_KERNEL, node); |
586 | if (!rqstp) | 598 | if (!rqstp) |
587 | goto out_enomem; | 599 | goto out_enomem; |
588 | 600 | ||
@@ -596,15 +608,15 @@ svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool) | |||
596 | rqstp->rq_server = serv; | 608 | rqstp->rq_server = serv; |
597 | rqstp->rq_pool = pool; | 609 | rqstp->rq_pool = pool; |
598 | 610 | ||
599 | rqstp->rq_argp = kmalloc(serv->sv_xdrsize, GFP_KERNEL); | 611 | rqstp->rq_argp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node); |
600 | if (!rqstp->rq_argp) | 612 | if (!rqstp->rq_argp) |
601 | goto out_thread; | 613 | goto out_thread; |
602 | 614 | ||
603 | rqstp->rq_resp = kmalloc(serv->sv_xdrsize, GFP_KERNEL); | 615 | rqstp->rq_resp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node); |
604 | if (!rqstp->rq_resp) | 616 | if (!rqstp->rq_resp) |
605 | goto out_thread; | 617 | goto out_thread; |
606 | 618 | ||
607 | if (!svc_init_buffer(rqstp, serv->sv_max_mesg)) | 619 | if (!svc_init_buffer(rqstp, serv->sv_max_mesg, node)) |
608 | goto out_thread; | 620 | goto out_thread; |
609 | 621 | ||
610 | return rqstp; | 622 | return rqstp; |
@@ -689,6 +701,7 @@ svc_set_num_threads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) | |||
689 | struct svc_pool *chosen_pool; | 701 | struct svc_pool *chosen_pool; |
690 | int error = 0; | 702 | int error = 0; |
691 | unsigned int state = serv->sv_nrthreads-1; | 703 | unsigned int state = serv->sv_nrthreads-1; |
704 | int node; | ||
692 | 705 | ||
693 | if (pool == NULL) { | 706 | if (pool == NULL) { |
694 | /* The -1 assumes caller has done a svc_get() */ | 707 | /* The -1 assumes caller has done a svc_get() */ |
@@ -704,14 +717,16 @@ svc_set_num_threads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) | |||
704 | nrservs--; | 717 | nrservs--; |
705 | chosen_pool = choose_pool(serv, pool, &state); | 718 | chosen_pool = choose_pool(serv, pool, &state); |
706 | 719 | ||
707 | rqstp = svc_prepare_thread(serv, chosen_pool); | 720 | node = svc_pool_map_get_node(chosen_pool->sp_id); |
721 | rqstp = svc_prepare_thread(serv, chosen_pool, node); | ||
708 | if (IS_ERR(rqstp)) { | 722 | if (IS_ERR(rqstp)) { |
709 | error = PTR_ERR(rqstp); | 723 | error = PTR_ERR(rqstp); |
710 | break; | 724 | break; |
711 | } | 725 | } |
712 | 726 | ||
713 | __module_get(serv->sv_module); | 727 | __module_get(serv->sv_module); |
714 | task = kthread_create(serv->sv_function, rqstp, serv->sv_name); | 728 | task = kthread_create_on_node(serv->sv_function, rqstp, |
729 | node, serv->sv_name); | ||
715 | if (IS_ERR(task)) { | 730 | if (IS_ERR(task)) { |
716 | error = PTR_ERR(task); | 731 | error = PTR_ERR(task); |
717 | module_put(serv->sv_module); | 732 | module_put(serv->sv_module); |
@@ -998,9 +1013,8 @@ static void svc_unregister(const struct svc_serv *serv) | |||
998 | /* | 1013 | /* |
999 | * Printk the given error with the address of the client that caused it. | 1014 | * Printk the given error with the address of the client that caused it. |
1000 | */ | 1015 | */ |
1001 | static int | 1016 | static __printf(2, 3) |
1002 | __attribute__ ((format (printf, 2, 3))) | 1017 | int svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) |
1003 | svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) | ||
1004 | { | 1018 | { |
1005 | va_list args; | 1019 | va_list args; |
1006 | int r; | 1020 | int r; |
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index bd31208bbb61..d86bb673e1f6 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
@@ -254,8 +254,6 @@ EXPORT_SYMBOL_GPL(svc_create_xprt); | |||
254 | */ | 254 | */ |
255 | void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt) | 255 | void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt) |
256 | { | 256 | { |
257 | struct sockaddr *sin; | ||
258 | |||
259 | memcpy(&rqstp->rq_addr, &xprt->xpt_remote, xprt->xpt_remotelen); | 257 | memcpy(&rqstp->rq_addr, &xprt->xpt_remote, xprt->xpt_remotelen); |
260 | rqstp->rq_addrlen = xprt->xpt_remotelen; | 258 | rqstp->rq_addrlen = xprt->xpt_remotelen; |
261 | 259 | ||
@@ -263,15 +261,8 @@ void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt) | |||
263 | * Destination address in request is needed for binding the | 261 | * Destination address in request is needed for binding the |
264 | * source address in RPC replies/callbacks later. | 262 | * source address in RPC replies/callbacks later. |
265 | */ | 263 | */ |
266 | sin = (struct sockaddr *)&xprt->xpt_local; | 264 | memcpy(&rqstp->rq_daddr, &xprt->xpt_local, xprt->xpt_locallen); |
267 | switch (sin->sa_family) { | 265 | rqstp->rq_daddrlen = xprt->xpt_locallen; |
268 | case AF_INET: | ||
269 | rqstp->rq_daddr.addr = ((struct sockaddr_in *)sin)->sin_addr; | ||
270 | break; | ||
271 | case AF_INET6: | ||
272 | rqstp->rq_daddr.addr6 = ((struct sockaddr_in6 *)sin)->sin6_addr; | ||
273 | break; | ||
274 | } | ||
275 | } | 266 | } |
276 | EXPORT_SYMBOL_GPL(svc_xprt_copy_addrs); | 267 | EXPORT_SYMBOL_GPL(svc_xprt_copy_addrs); |
277 | 268 | ||
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 767d494de7a2..dfd686eb0b7f 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -143,19 +143,20 @@ static void svc_set_cmsg_data(struct svc_rqst *rqstp, struct cmsghdr *cmh) | |||
143 | cmh->cmsg_level = SOL_IP; | 143 | cmh->cmsg_level = SOL_IP; |
144 | cmh->cmsg_type = IP_PKTINFO; | 144 | cmh->cmsg_type = IP_PKTINFO; |
145 | pki->ipi_ifindex = 0; | 145 | pki->ipi_ifindex = 0; |
146 | pki->ipi_spec_dst.s_addr = rqstp->rq_daddr.addr.s_addr; | 146 | pki->ipi_spec_dst.s_addr = |
147 | svc_daddr_in(rqstp)->sin_addr.s_addr; | ||
147 | cmh->cmsg_len = CMSG_LEN(sizeof(*pki)); | 148 | cmh->cmsg_len = CMSG_LEN(sizeof(*pki)); |
148 | } | 149 | } |
149 | break; | 150 | break; |
150 | 151 | ||
151 | case AF_INET6: { | 152 | case AF_INET6: { |
152 | struct in6_pktinfo *pki = CMSG_DATA(cmh); | 153 | struct in6_pktinfo *pki = CMSG_DATA(cmh); |
154 | struct sockaddr_in6 *daddr = svc_daddr_in6(rqstp); | ||
153 | 155 | ||
154 | cmh->cmsg_level = SOL_IPV6; | 156 | cmh->cmsg_level = SOL_IPV6; |
155 | cmh->cmsg_type = IPV6_PKTINFO; | 157 | cmh->cmsg_type = IPV6_PKTINFO; |
156 | pki->ipi6_ifindex = 0; | 158 | pki->ipi6_ifindex = daddr->sin6_scope_id; |
157 | ipv6_addr_copy(&pki->ipi6_addr, | 159 | ipv6_addr_copy(&pki->ipi6_addr, &daddr->sin6_addr); |
158 | &rqstp->rq_daddr.addr6); | ||
159 | cmh->cmsg_len = CMSG_LEN(sizeof(*pki)); | 160 | cmh->cmsg_len = CMSG_LEN(sizeof(*pki)); |
160 | } | 161 | } |
161 | break; | 162 | break; |
@@ -498,9 +499,13 @@ static int svc_udp_get_dest_address4(struct svc_rqst *rqstp, | |||
498 | struct cmsghdr *cmh) | 499 | struct cmsghdr *cmh) |
499 | { | 500 | { |
500 | struct in_pktinfo *pki = CMSG_DATA(cmh); | 501 | struct in_pktinfo *pki = CMSG_DATA(cmh); |
502 | struct sockaddr_in *daddr = svc_daddr_in(rqstp); | ||
503 | |||
501 | if (cmh->cmsg_type != IP_PKTINFO) | 504 | if (cmh->cmsg_type != IP_PKTINFO) |
502 | return 0; | 505 | return 0; |
503 | rqstp->rq_daddr.addr.s_addr = pki->ipi_spec_dst.s_addr; | 506 | |
507 | daddr->sin_family = AF_INET; | ||
508 | daddr->sin_addr.s_addr = pki->ipi_spec_dst.s_addr; | ||
504 | return 1; | 509 | return 1; |
505 | } | 510 | } |
506 | 511 | ||
@@ -511,9 +516,14 @@ static int svc_udp_get_dest_address6(struct svc_rqst *rqstp, | |||
511 | struct cmsghdr *cmh) | 516 | struct cmsghdr *cmh) |
512 | { | 517 | { |
513 | struct in6_pktinfo *pki = CMSG_DATA(cmh); | 518 | struct in6_pktinfo *pki = CMSG_DATA(cmh); |
519 | struct sockaddr_in6 *daddr = svc_daddr_in6(rqstp); | ||
520 | |||
514 | if (cmh->cmsg_type != IPV6_PKTINFO) | 521 | if (cmh->cmsg_type != IPV6_PKTINFO) |
515 | return 0; | 522 | return 0; |
516 | ipv6_addr_copy(&rqstp->rq_daddr.addr6, &pki->ipi6_addr); | 523 | |
524 | daddr->sin6_family = AF_INET6; | ||
525 | ipv6_addr_copy(&daddr->sin6_addr, &pki->ipi6_addr); | ||
526 | daddr->sin6_scope_id = pki->ipi6_ifindex; | ||
517 | return 1; | 527 | return 1; |
518 | } | 528 | } |
519 | 529 | ||
@@ -614,6 +624,7 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp) | |||
614 | skb_free_datagram_locked(svsk->sk_sk, skb); | 624 | skb_free_datagram_locked(svsk->sk_sk, skb); |
615 | return 0; | 625 | return 0; |
616 | } | 626 | } |
627 | rqstp->rq_daddrlen = svc_addr_len(svc_daddr(rqstp)); | ||
617 | 628 | ||
618 | if (skb_is_nonlinear(skb)) { | 629 | if (skb_is_nonlinear(skb)) { |
619 | /* we have to copy */ | 630 | /* we have to copy */ |