diff options
| author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
|---|---|---|
| committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
| commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
| tree | 644b88f8a71896307d71438e9b3af49126ffb22b /net/sunrpc | |
| parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
| parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) | |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'net/sunrpc')
40 files changed, 419 insertions, 329 deletions
diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c index c7450c8f0a7c..1419d0cdbbac 100644 --- a/net/sunrpc/addr.c +++ b/net/sunrpc/addr.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | 18 | ||
| 19 | #include <net/ipv6.h> | 19 | #include <net/ipv6.h> |
| 20 | #include <linux/sunrpc/clnt.h> | 20 | #include <linux/sunrpc/clnt.h> |
| 21 | #include <linux/slab.h> | ||
| 21 | 22 | ||
| 22 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 23 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
| 23 | 24 | ||
| @@ -55,16 +56,8 @@ static size_t rpc_ntop6_noscopeid(const struct sockaddr *sap, | |||
| 55 | 56 | ||
| 56 | /* | 57 | /* |
| 57 | * RFC 4291, Section 2.2.1 | 58 | * RFC 4291, Section 2.2.1 |
| 58 | * | ||
| 59 | * To keep the result as short as possible, especially | ||
| 60 | * since we don't shorthand, we don't want leading zeros | ||
| 61 | * in each halfword, so avoid %pI6. | ||
| 62 | */ | 59 | */ |
| 63 | return snprintf(buf, buflen, "%x:%x:%x:%x:%x:%x:%x:%x", | 60 | return snprintf(buf, buflen, "%pI6c", addr); |
| 64 | ntohs(addr->s6_addr16[0]), ntohs(addr->s6_addr16[1]), | ||
| 65 | ntohs(addr->s6_addr16[2]), ntohs(addr->s6_addr16[3]), | ||
| 66 | ntohs(addr->s6_addr16[4]), ntohs(addr->s6_addr16[5]), | ||
| 67 | ntohs(addr->s6_addr16[6]), ntohs(addr->s6_addr16[7])); | ||
| 68 | } | 61 | } |
| 69 | 62 | ||
| 70 | static size_t rpc_ntop6(const struct sockaddr *sap, | 63 | static size_t rpc_ntop6(const struct sockaddr *sap, |
| @@ -79,8 +72,9 @@ static size_t rpc_ntop6(const struct sockaddr *sap, | |||
| 79 | if (unlikely(len == 0)) | 72 | if (unlikely(len == 0)) |
| 80 | return len; | 73 | return len; |
| 81 | 74 | ||
| 82 | if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) && | 75 | if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)) |
| 83 | !(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_SITELOCAL)) | 76 | return len; |
| 77 | if (sin6->sin6_scope_id == 0) | ||
| 84 | return len; | 78 | return len; |
| 85 | 79 | ||
| 86 | rc = snprintf(scopebuf, sizeof(scopebuf), "%c%u", | 80 | rc = snprintf(scopebuf, sizeof(scopebuf), "%c%u", |
| @@ -173,8 +167,7 @@ static int rpc_parse_scope_id(const char *buf, const size_t buflen, | |||
| 173 | if (*delim != IPV6_SCOPE_DELIMITER) | 167 | if (*delim != IPV6_SCOPE_DELIMITER) |
| 174 | return 0; | 168 | return 0; |
| 175 | 169 | ||
| 176 | if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) && | 170 | if (!(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)) |
| 177 | !(ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_SITELOCAL)) | ||
| 178 | return 0; | 171 | return 0; |
| 179 | 172 | ||
| 180 | len = (buf + buflen) - delim - 1; | 173 | len = (buf + buflen) - delim - 1; |
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 54a4e042f104..95afe79dd9d7 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
| @@ -123,16 +123,19 @@ rpcauth_unhash_cred_locked(struct rpc_cred *cred) | |||
| 123 | clear_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags); | 123 | clear_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | static void | 126 | static int |
| 127 | rpcauth_unhash_cred(struct rpc_cred *cred) | 127 | rpcauth_unhash_cred(struct rpc_cred *cred) |
| 128 | { | 128 | { |
| 129 | spinlock_t *cache_lock; | 129 | spinlock_t *cache_lock; |
| 130 | int ret; | ||
| 130 | 131 | ||
| 131 | cache_lock = &cred->cr_auth->au_credcache->lock; | 132 | cache_lock = &cred->cr_auth->au_credcache->lock; |
| 132 | spin_lock(cache_lock); | 133 | spin_lock(cache_lock); |
| 133 | if (atomic_read(&cred->cr_count) == 0) | 134 | ret = atomic_read(&cred->cr_count) == 0; |
| 135 | if (ret) | ||
| 134 | rpcauth_unhash_cred_locked(cred); | 136 | rpcauth_unhash_cred_locked(cred); |
| 135 | spin_unlock(cache_lock); | 137 | spin_unlock(cache_lock); |
| 138 | return ret; | ||
| 136 | } | 139 | } |
| 137 | 140 | ||
| 138 | /* | 141 | /* |
| @@ -234,7 +237,7 @@ rpcauth_prune_expired(struct list_head *free, int nr_to_scan) | |||
| 234 | list_for_each_entry_safe(cred, next, &cred_unused, cr_lru) { | 237 | list_for_each_entry_safe(cred, next, &cred_unused, cr_lru) { |
| 235 | 238 | ||
| 236 | /* Enforce a 60 second garbage collection moratorium */ | 239 | /* Enforce a 60 second garbage collection moratorium */ |
| 237 | if (time_in_range_open(cred->cr_expire, expired, jiffies) && | 240 | if (time_in_range(cred->cr_expire, expired, jiffies) && |
| 238 | test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) | 241 | test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) |
| 239 | continue; | 242 | continue; |
| 240 | 243 | ||
| @@ -332,9 +335,9 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred, | |||
| 332 | list_add_tail(&new->cr_lru, &free); | 335 | list_add_tail(&new->cr_lru, &free); |
| 333 | spin_unlock(&cache->lock); | 336 | spin_unlock(&cache->lock); |
| 334 | found: | 337 | found: |
| 335 | if (test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags) | 338 | if (test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags) && |
| 336 | && cred->cr_ops->cr_init != NULL | 339 | cred->cr_ops->cr_init != NULL && |
| 337 | && !(flags & RPCAUTH_LOOKUP_NEW)) { | 340 | !(flags & RPCAUTH_LOOKUP_NEW)) { |
| 338 | int res = cred->cr_ops->cr_init(auth, cred); | 341 | int res = cred->cr_ops->cr_init(auth, cred); |
| 339 | if (res < 0) { | 342 | if (res < 0) { |
| 340 | put_rpccred(cred); | 343 | put_rpccred(cred); |
| @@ -446,31 +449,35 @@ void | |||
| 446 | put_rpccred(struct rpc_cred *cred) | 449 | put_rpccred(struct rpc_cred *cred) |
| 447 | { | 450 | { |
| 448 | /* Fast path for unhashed credentials */ | 451 | /* Fast path for unhashed credentials */ |
| 449 | if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) | 452 | if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) == 0) { |
| 450 | goto need_lock; | 453 | if (atomic_dec_and_test(&cred->cr_count)) |
| 451 | 454 | cred->cr_ops->crdestroy(cred); | |
| 452 | if (!atomic_dec_and_test(&cred->cr_count)) | ||
| 453 | return; | 455 | return; |
| 454 | goto out_destroy; | 456 | } |
| 455 | need_lock: | 457 | |
| 456 | if (!atomic_dec_and_lock(&cred->cr_count, &rpc_credcache_lock)) | 458 | if (!atomic_dec_and_lock(&cred->cr_count, &rpc_credcache_lock)) |
| 457 | return; | 459 | return; |
| 458 | if (!list_empty(&cred->cr_lru)) { | 460 | if (!list_empty(&cred->cr_lru)) { |
| 459 | number_cred_unused--; | 461 | number_cred_unused--; |
| 460 | list_del_init(&cred->cr_lru); | 462 | list_del_init(&cred->cr_lru); |
| 461 | } | 463 | } |
| 462 | if (test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) == 0) | ||
| 463 | rpcauth_unhash_cred(cred); | ||
| 464 | if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) { | 464 | if (test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) { |
| 465 | cred->cr_expire = jiffies; | 465 | if (test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0) { |
| 466 | list_add_tail(&cred->cr_lru, &cred_unused); | 466 | cred->cr_expire = jiffies; |
| 467 | number_cred_unused++; | 467 | list_add_tail(&cred->cr_lru, &cred_unused); |
| 468 | spin_unlock(&rpc_credcache_lock); | 468 | number_cred_unused++; |
| 469 | return; | 469 | goto out_nodestroy; |
| 470 | } | ||
| 471 | if (!rpcauth_unhash_cred(cred)) { | ||
| 472 | /* We were hashed and someone looked us up... */ | ||
| 473 | goto out_nodestroy; | ||
| 474 | } | ||
| 470 | } | 475 | } |
| 471 | spin_unlock(&rpc_credcache_lock); | 476 | spin_unlock(&rpc_credcache_lock); |
| 472 | out_destroy: | ||
| 473 | cred->cr_ops->crdestroy(cred); | 477 | cred->cr_ops->crdestroy(cred); |
| 478 | return; | ||
| 479 | out_nodestroy: | ||
| 480 | spin_unlock(&rpc_credcache_lock); | ||
| 474 | } | 481 | } |
| 475 | EXPORT_SYMBOL_GPL(put_rpccred); | 482 | EXPORT_SYMBOL_GPL(put_rpccred); |
| 476 | 483 | ||
diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c index bf88bf8e9365..8f623b0f03dd 100644 --- a/net/sunrpc/auth_generic.c +++ b/net/sunrpc/auth_generic.c | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #include <linux/err.h> | 7 | #include <linux/err.h> |
| 8 | #include <linux/slab.h> | ||
| 8 | #include <linux/types.h> | 9 | #include <linux/types.h> |
| 9 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 10 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index fc6a43ccd950..c389ccf6437d 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
| @@ -206,8 +206,14 @@ gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct | |||
| 206 | ctx->gc_win = window_size; | 206 | ctx->gc_win = window_size; |
| 207 | /* gssd signals an error by passing ctx->gc_win = 0: */ | 207 | /* gssd signals an error by passing ctx->gc_win = 0: */ |
| 208 | if (ctx->gc_win == 0) { | 208 | if (ctx->gc_win == 0) { |
| 209 | /* in which case, p points to an error code which we ignore */ | 209 | /* |
| 210 | p = ERR_PTR(-EACCES); | 210 | * in which case, p points to an error code. Anything other |
| 211 | * than -EKEYEXPIRED gets converted to -EACCES. | ||
| 212 | */ | ||
| 213 | p = simple_get_bytes(p, end, &ret, sizeof(ret)); | ||
| 214 | if (!IS_ERR(p)) | ||
| 215 | p = (ret == -EKEYEXPIRED) ? ERR_PTR(-EKEYEXPIRED) : | ||
| 216 | ERR_PTR(-EACCES); | ||
| 211 | goto err; | 217 | goto err; |
| 212 | } | 218 | } |
| 213 | /* copy the opaque wire context */ | 219 | /* copy the opaque wire context */ |
| @@ -304,7 +310,7 @@ __gss_find_upcall(struct rpc_inode *rpci, uid_t uid) | |||
| 304 | * to that upcall instead of adding the new upcall. | 310 | * to that upcall instead of adding the new upcall. |
| 305 | */ | 311 | */ |
| 306 | static inline struct gss_upcall_msg * | 312 | static inline struct gss_upcall_msg * |
| 307 | gss_add_msg(struct gss_auth *gss_auth, struct gss_upcall_msg *gss_msg) | 313 | gss_add_msg(struct gss_upcall_msg *gss_msg) |
| 308 | { | 314 | { |
| 309 | struct rpc_inode *rpci = gss_msg->inode; | 315 | struct rpc_inode *rpci = gss_msg->inode; |
| 310 | struct inode *inode = &rpci->vfs_inode; | 316 | struct inode *inode = &rpci->vfs_inode; |
| @@ -445,7 +451,7 @@ gss_setup_upcall(struct rpc_clnt *clnt, struct gss_auth *gss_auth, struct rpc_cr | |||
| 445 | gss_new = gss_alloc_msg(gss_auth, uid, clnt, gss_cred->gc_machine_cred); | 451 | gss_new = gss_alloc_msg(gss_auth, uid, clnt, gss_cred->gc_machine_cred); |
| 446 | if (IS_ERR(gss_new)) | 452 | if (IS_ERR(gss_new)) |
| 447 | return gss_new; | 453 | return gss_new; |
| 448 | gss_msg = gss_add_msg(gss_auth, gss_new); | 454 | gss_msg = gss_add_msg(gss_new); |
| 449 | if (gss_msg == gss_new) { | 455 | if (gss_msg == gss_new) { |
| 450 | struct inode *inode = &gss_new->inode->vfs_inode; | 456 | struct inode *inode = &gss_new->inode->vfs_inode; |
| 451 | int res = rpc_queue_upcall(inode, &gss_new->msg); | 457 | int res = rpc_queue_upcall(inode, &gss_new->msg); |
| @@ -485,7 +491,7 @@ gss_refresh_upcall(struct rpc_task *task) | |||
| 485 | dprintk("RPC: %5u gss_refresh_upcall for uid %u\n", task->tk_pid, | 491 | dprintk("RPC: %5u gss_refresh_upcall for uid %u\n", task->tk_pid, |
| 486 | cred->cr_uid); | 492 | cred->cr_uid); |
| 487 | gss_msg = gss_setup_upcall(task->tk_client, gss_auth, cred); | 493 | gss_msg = gss_setup_upcall(task->tk_client, gss_auth, cred); |
| 488 | if (IS_ERR(gss_msg) == -EAGAIN) { | 494 | if (PTR_ERR(gss_msg) == -EAGAIN) { |
| 489 | /* XXX: warning on the first, under the assumption we | 495 | /* XXX: warning on the first, under the assumption we |
| 490 | * shouldn't normally hit this case on a refresh. */ | 496 | * shouldn't normally hit this case on a refresh. */ |
| 491 | warn_gssd(); | 497 | warn_gssd(); |
| @@ -644,7 +650,23 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | |||
| 644 | p = gss_fill_context(p, end, ctx, gss_msg->auth->mech); | 650 | p = gss_fill_context(p, end, ctx, gss_msg->auth->mech); |
| 645 | if (IS_ERR(p)) { | 651 | if (IS_ERR(p)) { |
| 646 | err = PTR_ERR(p); | 652 | err = PTR_ERR(p); |
| 647 | gss_msg->msg.errno = (err == -EAGAIN) ? -EAGAIN : -EACCES; | 653 | switch (err) { |
| 654 | case -EACCES: | ||
| 655 | case -EKEYEXPIRED: | ||
| 656 | gss_msg->msg.errno = err; | ||
| 657 | err = mlen; | ||
| 658 | break; | ||
| 659 | case -EFAULT: | ||
| 660 | case -ENOMEM: | ||
| 661 | case -EINVAL: | ||
| 662 | case -ENOSYS: | ||
| 663 | gss_msg->msg.errno = -EAGAIN; | ||
| 664 | break; | ||
| 665 | default: | ||
| 666 | printk(KERN_CRIT "%s: bad return from " | ||
| 667 | "gss_fill_context: %zd\n", __func__, err); | ||
| 668 | BUG(); | ||
| 669 | } | ||
| 648 | goto err_release_msg; | 670 | goto err_release_msg; |
| 649 | } | 671 | } |
| 650 | gss_msg->ctx = gss_get_ctx(ctx); | 672 | gss_msg->ctx = gss_get_ctx(ctx); |
| @@ -1258,9 +1280,8 @@ alloc_enc_pages(struct rpc_rqst *rqstp) | |||
| 1258 | rqstp->rq_release_snd_buf = priv_release_snd_buf; | 1280 | rqstp->rq_release_snd_buf = priv_release_snd_buf; |
| 1259 | return 0; | 1281 | return 0; |
| 1260 | out_free: | 1282 | out_free: |
| 1261 | for (i--; i >= 0; i--) { | 1283 | rqstp->rq_enc_pages_num = i; |
| 1262 | __free_page(rqstp->rq_enc_pages[i]); | 1284 | priv_release_snd_buf(rqstp); |
| 1263 | } | ||
| 1264 | out: | 1285 | out: |
| 1265 | return -EAGAIN; | 1286 | return -EAGAIN; |
| 1266 | } | 1287 | } |
diff --git a/net/sunrpc/auth_gss/gss_generic_token.c b/net/sunrpc/auth_gss/gss_generic_token.c index c0ba39c4f5f2..310b78e99456 100644 --- a/net/sunrpc/auth_gss/gss_generic_token.c +++ b/net/sunrpc/auth_gss/gss_generic_token.c | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | 33 | ||
| 34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
| 35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
| 36 | #include <linux/slab.h> | ||
| 37 | #include <linux/string.h> | 36 | #include <linux/string.h> |
| 38 | #include <linux/sunrpc/sched.h> | 37 | #include <linux/sunrpc/sched.h> |
| 39 | #include <linux/sunrpc/gss_asn1.h> | 38 | #include <linux/sunrpc/gss_asn1.h> |
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c index c93fca204558..e9b636176687 100644 --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c | |||
| @@ -37,7 +37,6 @@ | |||
| 37 | #include <linux/err.h> | 37 | #include <linux/err.h> |
| 38 | #include <linux/types.h> | 38 | #include <linux/types.h> |
| 39 | #include <linux/mm.h> | 39 | #include <linux/mm.h> |
| 40 | #include <linux/slab.h> | ||
| 41 | #include <linux/scatterlist.h> | 40 | #include <linux/scatterlist.h> |
| 42 | #include <linux/crypto.h> | 41 | #include <linux/crypto.h> |
| 43 | #include <linux/highmem.h> | 42 | #include <linux/highmem.h> |
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c index ef45eba22485..2deb0ed72ff4 100644 --- a/net/sunrpc/auth_gss/gss_krb5_mech.c +++ b/net/sunrpc/auth_gss/gss_krb5_mech.c | |||
| @@ -131,8 +131,10 @@ gss_import_sec_context_kerberos(const void *p, | |||
| 131 | struct krb5_ctx *ctx; | 131 | struct krb5_ctx *ctx; |
| 132 | int tmp; | 132 | int tmp; |
| 133 | 133 | ||
| 134 | if (!(ctx = kzalloc(sizeof(*ctx), GFP_NOFS))) | 134 | if (!(ctx = kzalloc(sizeof(*ctx), GFP_NOFS))) { |
| 135 | p = ERR_PTR(-ENOMEM); | ||
| 135 | goto out_err; | 136 | goto out_err; |
| 137 | } | ||
| 136 | 138 | ||
| 137 | p = simple_get_bytes(p, end, &ctx->initiate, sizeof(ctx->initiate)); | 139 | p = simple_get_bytes(p, end, &ctx->initiate, sizeof(ctx->initiate)); |
| 138 | if (IS_ERR(p)) | 140 | if (IS_ERR(p)) |
diff --git a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c index b8f42ef7178e..88fe6e75ed7e 100644 --- a/net/sunrpc/auth_gss/gss_krb5_seal.c +++ b/net/sunrpc/auth_gss/gss_krb5_seal.c | |||
| @@ -59,7 +59,6 @@ | |||
| 59 | */ | 59 | */ |
| 60 | 60 | ||
| 61 | #include <linux/types.h> | 61 | #include <linux/types.h> |
| 62 | #include <linux/slab.h> | ||
| 63 | #include <linux/jiffies.h> | 62 | #include <linux/jiffies.h> |
| 64 | #include <linux/sunrpc/gss_krb5.h> | 63 | #include <linux/sunrpc/gss_krb5.h> |
| 65 | #include <linux/random.h> | 64 | #include <linux/random.h> |
diff --git a/net/sunrpc/auth_gss/gss_krb5_seqnum.c b/net/sunrpc/auth_gss/gss_krb5_seqnum.c index f160be6c1a46..6331cd6866ec 100644 --- a/net/sunrpc/auth_gss/gss_krb5_seqnum.c +++ b/net/sunrpc/auth_gss/gss_krb5_seqnum.c | |||
| @@ -32,7 +32,6 @@ | |||
| 32 | */ | 32 | */ |
| 33 | 33 | ||
| 34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
| 35 | #include <linux/slab.h> | ||
| 36 | #include <linux/sunrpc/gss_krb5.h> | 35 | #include <linux/sunrpc/gss_krb5.h> |
| 37 | #include <linux/crypto.h> | 36 | #include <linux/crypto.h> |
| 38 | 37 | ||
| @@ -75,8 +74,8 @@ krb5_get_seq_num(struct crypto_blkcipher *key, | |||
| 75 | if ((code = krb5_decrypt(key, cksum, buf, plain, 8))) | 74 | if ((code = krb5_decrypt(key, cksum, buf, plain, 8))) |
| 76 | return code; | 75 | return code; |
| 77 | 76 | ||
| 78 | if ((plain[4] != plain[5]) || (plain[4] != plain[6]) | 77 | if ((plain[4] != plain[5]) || (plain[4] != plain[6]) || |
| 79 | || (plain[4] != plain[7])) | 78 | (plain[4] != plain[7])) |
| 80 | return (s32)KG_BAD_SEQ; | 79 | return (s32)KG_BAD_SEQ; |
| 81 | 80 | ||
| 82 | *direction = plain[4]; | 81 | *direction = plain[4]; |
diff --git a/net/sunrpc/auth_gss/gss_krb5_unseal.c b/net/sunrpc/auth_gss/gss_krb5_unseal.c index 066ec73c84d6..ce6c247edad0 100644 --- a/net/sunrpc/auth_gss/gss_krb5_unseal.c +++ b/net/sunrpc/auth_gss/gss_krb5_unseal.c | |||
| @@ -58,7 +58,6 @@ | |||
| 58 | */ | 58 | */ |
| 59 | 59 | ||
| 60 | #include <linux/types.h> | 60 | #include <linux/types.h> |
| 61 | #include <linux/slab.h> | ||
| 62 | #include <linux/jiffies.h> | 61 | #include <linux/jiffies.h> |
| 63 | #include <linux/sunrpc/gss_krb5.h> | 62 | #include <linux/sunrpc/gss_krb5.h> |
| 64 | #include <linux/crypto.h> | 63 | #include <linux/crypto.h> |
diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c index ae8e69b59c4c..a6e905637e03 100644 --- a/net/sunrpc/auth_gss/gss_krb5_wrap.c +++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c | |||
| @@ -1,5 +1,4 @@ | |||
| 1 | #include <linux/types.h> | 1 | #include <linux/types.h> |
| 2 | #include <linux/slab.h> | ||
| 3 | #include <linux/jiffies.h> | 2 | #include <linux/jiffies.h> |
| 4 | #include <linux/sunrpc/gss_krb5.h> | 3 | #include <linux/sunrpc/gss_krb5.h> |
| 5 | #include <linux/random.h> | 4 | #include <linux/random.h> |
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c index 6efbb0cd3c7c..76e4c6f4ac3c 100644 --- a/net/sunrpc/auth_gss/gss_mech_switch.c +++ b/net/sunrpc/auth_gss/gss_mech_switch.c | |||
| @@ -252,7 +252,7 @@ gss_import_sec_context(const void *input_token, size_t bufsize, | |||
| 252 | struct gss_ctx **ctx_id) | 252 | struct gss_ctx **ctx_id) |
| 253 | { | 253 | { |
| 254 | if (!(*ctx_id = kzalloc(sizeof(**ctx_id), GFP_KERNEL))) | 254 | if (!(*ctx_id = kzalloc(sizeof(**ctx_id), GFP_KERNEL))) |
| 255 | return GSS_S_FAILURE; | 255 | return -ENOMEM; |
| 256 | (*ctx_id)->mech_type = gss_mech_get(mech); | 256 | (*ctx_id)->mech_type = gss_mech_get(mech); |
| 257 | 257 | ||
| 258 | return mech->gm_ops | 258 | return mech->gm_ops |
diff --git a/net/sunrpc/auth_gss/gss_spkm3_seal.c b/net/sunrpc/auth_gss/gss_spkm3_seal.c index c832712f8d55..5a3a65a0e2b4 100644 --- a/net/sunrpc/auth_gss/gss_spkm3_seal.c +++ b/net/sunrpc/auth_gss/gss_spkm3_seal.c | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | */ | 34 | */ |
| 35 | 35 | ||
| 36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
| 37 | #include <linux/slab.h> | ||
| 38 | #include <linux/jiffies.h> | 37 | #include <linux/jiffies.h> |
| 39 | #include <linux/sunrpc/gss_spkm3.h> | 38 | #include <linux/sunrpc/gss_spkm3.h> |
| 40 | #include <linux/random.h> | 39 | #include <linux/random.h> |
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index f6c51e562a02..b81e790ef9f4 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | * | 37 | * |
| 38 | */ | 38 | */ |
| 39 | 39 | ||
| 40 | #include <linux/slab.h> | ||
| 40 | #include <linux/types.h> | 41 | #include <linux/types.h> |
| 41 | #include <linux/module.h> | 42 | #include <linux/module.h> |
| 42 | #include <linux/pagemap.h> | 43 | #include <linux/pagemap.h> |
| @@ -105,8 +106,8 @@ static int rsi_match(struct cache_head *a, struct cache_head *b) | |||
| 105 | { | 106 | { |
| 106 | struct rsi *item = container_of(a, struct rsi, h); | 107 | struct rsi *item = container_of(a, struct rsi, h); |
| 107 | struct rsi *tmp = container_of(b, struct rsi, h); | 108 | struct rsi *tmp = container_of(b, struct rsi, h); |
| 108 | return netobj_equal(&item->in_handle, &tmp->in_handle) | 109 | return netobj_equal(&item->in_handle, &tmp->in_handle) && |
| 109 | && netobj_equal(&item->in_token, &tmp->in_token); | 110 | netobj_equal(&item->in_token, &tmp->in_token); |
| 110 | } | 111 | } |
| 111 | 112 | ||
| 112 | static int dup_to_netobj(struct xdr_netobj *dst, char *src, int len) | 113 | static int dup_to_netobj(struct xdr_netobj *dst, char *src, int len) |
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c index 46b2647c5bd2..aac2f8b4ee21 100644 --- a/net/sunrpc/auth_unix.c +++ b/net/sunrpc/auth_unix.c | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> | 6 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/slab.h> | ||
| 9 | #include <linux/types.h> | 10 | #include <linux/types.h> |
| 10 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
| 11 | #include <linux/module.h> | 12 | #include <linux/module.h> |
diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c index 553621fb2c41..cf06af3b63c6 100644 --- a/net/sunrpc/backchannel_rqst.c +++ b/net/sunrpc/backchannel_rqst.c | |||
| @@ -22,6 +22,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| 22 | ******************************************************************************/ | 22 | ******************************************************************************/ |
| 23 | 23 | ||
| 24 | #include <linux/tcp.h> | 24 | #include <linux/tcp.h> |
| 25 | #include <linux/slab.h> | ||
| 25 | #include <linux/sunrpc/xprt.h> | 26 | #include <linux/sunrpc/xprt.h> |
| 26 | 27 | ||
| 27 | #ifdef RPC_DEBUG | 28 | #ifdef RPC_DEBUG |
diff --git a/net/sunrpc/bc_svc.c b/net/sunrpc/bc_svc.c index 13f214f53120..f0c05d3311c1 100644 --- a/net/sunrpc/bc_svc.c +++ b/net/sunrpc/bc_svc.c | |||
| @@ -37,21 +37,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
| 37 | 37 | ||
| 38 | #define RPCDBG_FACILITY RPCDBG_SVCDSP | 38 | #define RPCDBG_FACILITY RPCDBG_SVCDSP |
| 39 | 39 | ||
| 40 | void bc_release_request(struct rpc_task *task) | ||
| 41 | { | ||
| 42 | struct rpc_rqst *req = task->tk_rqstp; | ||
| 43 | |||
| 44 | dprintk("RPC: bc_release_request: task= %p\n", task); | ||
| 45 | |||
| 46 | /* | ||
| 47 | * Release this request only if it's a backchannel | ||
| 48 | * preallocated request | ||
| 49 | */ | ||
| 50 | if (!bc_prealloc(req)) | ||
| 51 | return; | ||
| 52 | xprt_free_bc_request(req); | ||
| 53 | } | ||
| 54 | |||
| 55 | /* Empty callback ops */ | 40 | /* Empty callback ops */ |
| 56 | static const struct rpc_call_ops nfs41_callback_ops = { | 41 | static const struct rpc_call_ops nfs41_callback_ops = { |
| 57 | }; | 42 | }; |
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index d6eee291a0e2..39bddba53ba1 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
| @@ -401,9 +401,8 @@ static int cache_clean(void) | |||
| 401 | for (; ch; cp= & ch->next, ch= *cp) { | 401 | for (; ch; cp= & ch->next, ch= *cp) { |
| 402 | if (current_detail->nextcheck > ch->expiry_time) | 402 | if (current_detail->nextcheck > ch->expiry_time) |
| 403 | current_detail->nextcheck = ch->expiry_time+1; | 403 | current_detail->nextcheck = ch->expiry_time+1; |
| 404 | if (ch->expiry_time >= get_seconds() | 404 | if (ch->expiry_time >= get_seconds() && |
| 405 | && ch->last_refresh >= current_detail->flush_time | 405 | ch->last_refresh >= current_detail->flush_time) |
| 406 | ) | ||
| 407 | continue; | 406 | continue; |
| 408 | if (test_and_clear_bit(CACHE_PENDING, &ch->flags)) | 407 | if (test_and_clear_bit(CACHE_PENDING, &ch->flags)) |
| 409 | cache_dequeue(current_detail, ch); | 408 | cache_dequeue(current_detail, ch); |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 38829e20500b..19c9983d5360 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
| @@ -79,7 +79,7 @@ static void call_connect_status(struct rpc_task *task); | |||
| 79 | 79 | ||
| 80 | static __be32 *rpc_encode_header(struct rpc_task *task); | 80 | static __be32 *rpc_encode_header(struct rpc_task *task); |
| 81 | static __be32 *rpc_verify_header(struct rpc_task *task); | 81 | static __be32 *rpc_verify_header(struct rpc_task *task); |
| 82 | static int rpc_ping(struct rpc_clnt *clnt, int flags); | 82 | static int rpc_ping(struct rpc_clnt *clnt); |
| 83 | 83 | ||
| 84 | static void rpc_register_client(struct rpc_clnt *clnt) | 84 | static void rpc_register_client(struct rpc_clnt *clnt) |
| 85 | { | 85 | { |
| @@ -340,7 +340,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
| 340 | return clnt; | 340 | return clnt; |
| 341 | 341 | ||
| 342 | if (!(args->flags & RPC_CLNT_CREATE_NOPING)) { | 342 | if (!(args->flags & RPC_CLNT_CREATE_NOPING)) { |
| 343 | int err = rpc_ping(clnt, RPC_TASK_SOFT); | 343 | int err = rpc_ping(clnt); |
| 344 | if (err != 0) { | 344 | if (err != 0) { |
| 345 | rpc_shutdown_client(clnt); | 345 | rpc_shutdown_client(clnt); |
| 346 | return ERR_PTR(err); | 346 | return ERR_PTR(err); |
| @@ -528,7 +528,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old, | |||
| 528 | clnt->cl_prog = program->number; | 528 | clnt->cl_prog = program->number; |
| 529 | clnt->cl_vers = version->number; | 529 | clnt->cl_vers = version->number; |
| 530 | clnt->cl_stats = program->stats; | 530 | clnt->cl_stats = program->stats; |
| 531 | err = rpc_ping(clnt, RPC_TASK_SOFT); | 531 | err = rpc_ping(clnt); |
| 532 | if (err != 0) { | 532 | if (err != 0) { |
| 533 | rpc_shutdown_client(clnt); | 533 | rpc_shutdown_client(clnt); |
| 534 | clnt = ERR_PTR(err); | 534 | clnt = ERR_PTR(err); |
| @@ -659,6 +659,7 @@ struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req, | |||
| 659 | task = rpc_new_task(&task_setup_data); | 659 | task = rpc_new_task(&task_setup_data); |
| 660 | if (!task) { | 660 | if (!task) { |
| 661 | xprt_free_bc_request(req); | 661 | xprt_free_bc_request(req); |
| 662 | task = ERR_PTR(-ENOMEM); | ||
| 662 | goto out; | 663 | goto out; |
| 663 | } | 664 | } |
| 664 | task->tk_rqstp = req; | 665 | task->tk_rqstp = req; |
| @@ -1060,7 +1061,7 @@ call_bind_status(struct rpc_task *task) | |||
| 1060 | goto retry_timeout; | 1061 | goto retry_timeout; |
| 1061 | case -EPFNOSUPPORT: | 1062 | case -EPFNOSUPPORT: |
| 1062 | /* server doesn't support any rpcbind version we know of */ | 1063 | /* server doesn't support any rpcbind version we know of */ |
| 1063 | dprintk("RPC: %5u remote rpcbind service unavailable\n", | 1064 | dprintk("RPC: %5u unrecognized remote rpcbind service\n", |
| 1064 | task->tk_pid); | 1065 | task->tk_pid); |
| 1065 | break; | 1066 | break; |
| 1066 | case -EPROTONOSUPPORT: | 1067 | case -EPROTONOSUPPORT: |
| @@ -1069,6 +1070,21 @@ call_bind_status(struct rpc_task *task) | |||
| 1069 | task->tk_status = 0; | 1070 | task->tk_status = 0; |
| 1070 | task->tk_action = call_bind; | 1071 | task->tk_action = call_bind; |
| 1071 | return; | 1072 | return; |
| 1073 | case -ECONNREFUSED: /* connection problems */ | ||
| 1074 | case -ECONNRESET: | ||
| 1075 | case -ENOTCONN: | ||
| 1076 | case -EHOSTDOWN: | ||
| 1077 | case -EHOSTUNREACH: | ||
| 1078 | case -ENETUNREACH: | ||
| 1079 | case -EPIPE: | ||
| 1080 | dprintk("RPC: %5u remote rpcbind unreachable: %d\n", | ||
| 1081 | task->tk_pid, task->tk_status); | ||
| 1082 | if (!RPC_IS_SOFTCONN(task)) { | ||
| 1083 | rpc_delay(task, 5*HZ); | ||
| 1084 | goto retry_timeout; | ||
| 1085 | } | ||
| 1086 | status = task->tk_status; | ||
| 1087 | break; | ||
| 1072 | default: | 1088 | default: |
| 1073 | dprintk("RPC: %5u unrecognized rpcbind error (%d)\n", | 1089 | dprintk("RPC: %5u unrecognized rpcbind error (%d)\n", |
| 1074 | task->tk_pid, -task->tk_status); | 1090 | task->tk_pid, -task->tk_status); |
| @@ -1180,11 +1196,25 @@ static void | |||
| 1180 | call_transmit_status(struct rpc_task *task) | 1196 | call_transmit_status(struct rpc_task *task) |
| 1181 | { | 1197 | { |
| 1182 | task->tk_action = call_status; | 1198 | task->tk_action = call_status; |
| 1199 | |||
| 1200 | /* | ||
| 1201 | * Common case: success. Force the compiler to put this | ||
| 1202 | * test first. | ||
| 1203 | */ | ||
| 1204 | if (task->tk_status == 0) { | ||
| 1205 | xprt_end_transmit(task); | ||
| 1206 | rpc_task_force_reencode(task); | ||
| 1207 | return; | ||
| 1208 | } | ||
| 1209 | |||
| 1183 | switch (task->tk_status) { | 1210 | switch (task->tk_status) { |
| 1184 | case -EAGAIN: | 1211 | case -EAGAIN: |
| 1185 | break; | 1212 | break; |
| 1186 | default: | 1213 | default: |
| 1214 | dprint_status(task); | ||
| 1187 | xprt_end_transmit(task); | 1215 | xprt_end_transmit(task); |
| 1216 | rpc_task_force_reencode(task); | ||
| 1217 | break; | ||
| 1188 | /* | 1218 | /* |
| 1189 | * Special cases: if we've been waiting on the | 1219 | * Special cases: if we've been waiting on the |
| 1190 | * socket's write_space() callback, or if the | 1220 | * socket's write_space() callback, or if the |
| @@ -1192,11 +1222,16 @@ call_transmit_status(struct rpc_task *task) | |||
| 1192 | * then hold onto the transport lock. | 1222 | * then hold onto the transport lock. |
| 1193 | */ | 1223 | */ |
| 1194 | case -ECONNREFUSED: | 1224 | case -ECONNREFUSED: |
| 1195 | case -ECONNRESET: | ||
| 1196 | case -ENOTCONN: | ||
| 1197 | case -EHOSTDOWN: | 1225 | case -EHOSTDOWN: |
| 1198 | case -EHOSTUNREACH: | 1226 | case -EHOSTUNREACH: |
| 1199 | case -ENETUNREACH: | 1227 | case -ENETUNREACH: |
| 1228 | if (RPC_IS_SOFTCONN(task)) { | ||
| 1229 | xprt_end_transmit(task); | ||
| 1230 | rpc_exit(task, task->tk_status); | ||
| 1231 | break; | ||
| 1232 | } | ||
| 1233 | case -ECONNRESET: | ||
| 1234 | case -ENOTCONN: | ||
| 1200 | case -EPIPE: | 1235 | case -EPIPE: |
| 1201 | rpc_task_force_reencode(task); | 1236 | rpc_task_force_reencode(task); |
| 1202 | } | 1237 | } |
| @@ -1346,6 +1381,10 @@ call_timeout(struct rpc_task *task) | |||
| 1346 | dprintk("RPC: %5u call_timeout (major)\n", task->tk_pid); | 1381 | dprintk("RPC: %5u call_timeout (major)\n", task->tk_pid); |
| 1347 | task->tk_timeouts++; | 1382 | task->tk_timeouts++; |
| 1348 | 1383 | ||
| 1384 | if (RPC_IS_SOFTCONN(task)) { | ||
| 1385 | rpc_exit(task, -ETIMEDOUT); | ||
| 1386 | return; | ||
| 1387 | } | ||
| 1349 | if (RPC_IS_SOFT(task)) { | 1388 | if (RPC_IS_SOFT(task)) { |
| 1350 | if (clnt->cl_chatty) | 1389 | if (clnt->cl_chatty) |
| 1351 | printk(KERN_NOTICE "%s: server %s not responding, timed out\n", | 1390 | printk(KERN_NOTICE "%s: server %s not responding, timed out\n", |
| @@ -1675,14 +1714,14 @@ static struct rpc_procinfo rpcproc_null = { | |||
| 1675 | .p_decode = rpcproc_decode_null, | 1714 | .p_decode = rpcproc_decode_null, |
| 1676 | }; | 1715 | }; |
| 1677 | 1716 | ||
| 1678 | static int rpc_ping(struct rpc_clnt *clnt, int flags) | 1717 | static int rpc_ping(struct rpc_clnt *clnt) |
| 1679 | { | 1718 | { |
| 1680 | struct rpc_message msg = { | 1719 | struct rpc_message msg = { |
| 1681 | .rpc_proc = &rpcproc_null, | 1720 | .rpc_proc = &rpcproc_null, |
| 1682 | }; | 1721 | }; |
| 1683 | int err; | 1722 | int err; |
| 1684 | msg.rpc_cred = authnull_ops.lookup_cred(NULL, NULL, 0); | 1723 | msg.rpc_cred = authnull_ops.lookup_cred(NULL, NULL, 0); |
| 1685 | err = rpc_call_sync(clnt, &msg, flags); | 1724 | err = rpc_call_sync(clnt, &msg, RPC_TASK_SOFT | RPC_TASK_SOFTCONN); |
| 1686 | put_rpccred(msg.rpc_cred); | 1725 | put_rpccred(msg.rpc_cred); |
| 1687 | return err; | 1726 | return err; |
| 1688 | } | 1727 | } |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 49278f830367..20e30c6f8355 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
| @@ -78,7 +78,7 @@ rpc_timeout_upcall_queue(struct work_struct *work) | |||
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | /** | 80 | /** |
| 81 | * rpc_queue_upcall | 81 | * rpc_queue_upcall - queue an upcall message to userspace |
| 82 | * @inode: inode of upcall pipe on which to queue given message | 82 | * @inode: inode of upcall pipe on which to queue given message |
| 83 | * @msg: message to queue | 83 | * @msg: message to queue |
| 84 | * | 84 | * |
| @@ -587,6 +587,8 @@ static struct dentry *__rpc_lookup_create_exclusive(struct dentry *parent, | |||
| 587 | struct dentry *dentry; | 587 | struct dentry *dentry; |
| 588 | 588 | ||
| 589 | dentry = __rpc_lookup_create(parent, name); | 589 | dentry = __rpc_lookup_create(parent, name); |
| 590 | if (IS_ERR(dentry)) | ||
| 591 | return dentry; | ||
| 590 | if (dentry->d_inode == NULL) | 592 | if (dentry->d_inode == NULL) |
| 591 | return dentry; | 593 | return dentry; |
| 592 | dput(dentry); | 594 | dput(dentry); |
| @@ -999,19 +1001,14 @@ rpc_fill_super(struct super_block *sb, void *data, int silent) | |||
| 999 | inode = rpc_get_inode(sb, S_IFDIR | 0755); | 1001 | inode = rpc_get_inode(sb, S_IFDIR | 0755); |
| 1000 | if (!inode) | 1002 | if (!inode) |
| 1001 | return -ENOMEM; | 1003 | return -ENOMEM; |
| 1002 | root = d_alloc_root(inode); | 1004 | sb->s_root = root = d_alloc_root(inode); |
| 1003 | if (!root) { | 1005 | if (!root) { |
| 1004 | iput(inode); | 1006 | iput(inode); |
| 1005 | return -ENOMEM; | 1007 | return -ENOMEM; |
| 1006 | } | 1008 | } |
| 1007 | if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL)) | 1009 | if (rpc_populate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF, NULL)) |
| 1008 | goto out; | 1010 | return -ENOMEM; |
| 1009 | sb->s_root = root; | ||
| 1010 | return 0; | 1011 | return 0; |
| 1011 | out: | ||
| 1012 | d_genocide(root); | ||
| 1013 | dput(root); | ||
| 1014 | return -ENOMEM; | ||
| 1015 | } | 1012 | } |
| 1016 | 1013 | ||
| 1017 | static int | 1014 | static int |
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 830faf4d9997..121105355f60 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | #include <linux/in6.h> | 20 | #include <linux/in6.h> |
| 21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
| 22 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
| 23 | #include <linux/mutex.h> | ||
| 24 | #include <linux/slab.h> | ||
| 23 | #include <net/ipv6.h> | 25 | #include <net/ipv6.h> |
| 24 | 26 | ||
| 25 | #include <linux/sunrpc/clnt.h> | 27 | #include <linux/sunrpc/clnt.h> |
| @@ -110,6 +112,9 @@ static void rpcb_getport_done(struct rpc_task *, void *); | |||
| 110 | static void rpcb_map_release(void *data); | 112 | static void rpcb_map_release(void *data); |
| 111 | static struct rpc_program rpcb_program; | 113 | static struct rpc_program rpcb_program; |
| 112 | 114 | ||
| 115 | static struct rpc_clnt * rpcb_local_clnt; | ||
| 116 | static struct rpc_clnt * rpcb_local_clnt4; | ||
| 117 | |||
| 113 | struct rpcbind_args { | 118 | struct rpcbind_args { |
| 114 | struct rpc_xprt * r_xprt; | 119 | struct rpc_xprt * r_xprt; |
| 115 | 120 | ||
| @@ -163,21 +168,60 @@ static const struct sockaddr_in rpcb_inaddr_loopback = { | |||
| 163 | .sin_port = htons(RPCBIND_PORT), | 168 | .sin_port = htons(RPCBIND_PORT), |
| 164 | }; | 169 | }; |
| 165 | 170 | ||
| 166 | static struct rpc_clnt *rpcb_create_local(struct sockaddr *addr, | 171 | static DEFINE_MUTEX(rpcb_create_local_mutex); |
| 167 | size_t addrlen, u32 version) | 172 | |
| 173 | /* | ||
| 174 | * Returns zero on success, otherwise a negative errno value | ||
| 175 | * is returned. | ||
| 176 | */ | ||
| 177 | static int rpcb_create_local(void) | ||
| 168 | { | 178 | { |
| 169 | struct rpc_create_args args = { | 179 | struct rpc_create_args args = { |
| 170 | .protocol = XPRT_TRANSPORT_UDP, | 180 | .protocol = XPRT_TRANSPORT_TCP, |
| 171 | .address = addr, | 181 | .address = (struct sockaddr *)&rpcb_inaddr_loopback, |
| 172 | .addrsize = addrlen, | 182 | .addrsize = sizeof(rpcb_inaddr_loopback), |
| 173 | .servername = "localhost", | 183 | .servername = "localhost", |
| 174 | .program = &rpcb_program, | 184 | .program = &rpcb_program, |
| 175 | .version = version, | 185 | .version = RPCBVERS_2, |
| 176 | .authflavor = RPC_AUTH_UNIX, | 186 | .authflavor = RPC_AUTH_UNIX, |
| 177 | .flags = RPC_CLNT_CREATE_NOPING, | 187 | .flags = RPC_CLNT_CREATE_NOPING, |
| 178 | }; | 188 | }; |
| 189 | struct rpc_clnt *clnt, *clnt4; | ||
| 190 | int result = 0; | ||
| 191 | |||
| 192 | if (rpcb_local_clnt) | ||
| 193 | return result; | ||
| 194 | |||
| 195 | mutex_lock(&rpcb_create_local_mutex); | ||
| 196 | if (rpcb_local_clnt) | ||
| 197 | goto out; | ||
| 198 | |||
| 199 | clnt = rpc_create(&args); | ||
| 200 | if (IS_ERR(clnt)) { | ||
| 201 | dprintk("RPC: failed to create local rpcbind " | ||
| 202 | "client (errno %ld).\n", PTR_ERR(clnt)); | ||
| 203 | result = -PTR_ERR(clnt); | ||
| 204 | goto out; | ||
| 205 | } | ||
| 179 | 206 | ||
| 180 | return rpc_create(&args); | 207 | /* |
| 208 | * This results in an RPC ping. On systems running portmapper, | ||
| 209 | * the v4 ping will fail. Proceed anyway, but disallow rpcb | ||
| 210 | * v4 upcalls. | ||
| 211 | */ | ||
| 212 | clnt4 = rpc_bind_new_program(clnt, &rpcb_program, RPCBVERS_4); | ||
| 213 | if (IS_ERR(clnt4)) { | ||
| 214 | dprintk("RPC: failed to create local rpcbind v4 " | ||
| 215 | "cleint (errno %ld).\n", PTR_ERR(clnt4)); | ||
| 216 | clnt4 = NULL; | ||
| 217 | } | ||
| 218 | |||
| 219 | rpcb_local_clnt = clnt; | ||
| 220 | rpcb_local_clnt4 = clnt4; | ||
| 221 | |||
| 222 | out: | ||
| 223 | mutex_unlock(&rpcb_create_local_mutex); | ||
| 224 | return result; | ||
| 181 | } | 225 | } |
| 182 | 226 | ||
| 183 | static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, | 227 | static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, |
| @@ -209,22 +253,13 @@ static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, | |||
| 209 | return rpc_create(&args); | 253 | return rpc_create(&args); |
| 210 | } | 254 | } |
| 211 | 255 | ||
| 212 | static int rpcb_register_call(const u32 version, struct rpc_message *msg) | 256 | static int rpcb_register_call(struct rpc_clnt *clnt, struct rpc_message *msg) |
| 213 | { | 257 | { |
| 214 | struct sockaddr *addr = (struct sockaddr *)&rpcb_inaddr_loopback; | ||
| 215 | size_t addrlen = sizeof(rpcb_inaddr_loopback); | ||
| 216 | struct rpc_clnt *rpcb_clnt; | ||
| 217 | int result, error = 0; | 258 | int result, error = 0; |
| 218 | 259 | ||
| 219 | msg->rpc_resp = &result; | 260 | msg->rpc_resp = &result; |
| 220 | 261 | ||
| 221 | rpcb_clnt = rpcb_create_local(addr, addrlen, version); | 262 | error = rpc_call_sync(clnt, msg, RPC_TASK_SOFTCONN); |
| 222 | if (!IS_ERR(rpcb_clnt)) { | ||
| 223 | error = rpc_call_sync(rpcb_clnt, msg, 0); | ||
| 224 | rpc_shutdown_client(rpcb_clnt); | ||
| 225 | } else | ||
| 226 | error = PTR_ERR(rpcb_clnt); | ||
| 227 | |||
| 228 | if (error < 0) { | 263 | if (error < 0) { |
| 229 | dprintk("RPC: failed to contact local rpcbind " | 264 | dprintk("RPC: failed to contact local rpcbind " |
| 230 | "server (errno %d).\n", -error); | 265 | "server (errno %d).\n", -error); |
| @@ -279,6 +314,11 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port) | |||
| 279 | struct rpc_message msg = { | 314 | struct rpc_message msg = { |
| 280 | .rpc_argp = &map, | 315 | .rpc_argp = &map, |
| 281 | }; | 316 | }; |
| 317 | int error; | ||
| 318 | |||
| 319 | error = rpcb_create_local(); | ||
| 320 | if (error) | ||
| 321 | return error; | ||
| 282 | 322 | ||
| 283 | dprintk("RPC: %sregistering (%u, %u, %d, %u) with local " | 323 | dprintk("RPC: %sregistering (%u, %u, %d, %u) with local " |
| 284 | "rpcbind\n", (port ? "" : "un"), | 324 | "rpcbind\n", (port ? "" : "un"), |
| @@ -288,7 +328,7 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port) | |||
| 288 | if (port) | 328 | if (port) |
| 289 | msg.rpc_proc = &rpcb_procedures2[RPCBPROC_SET]; | 329 | msg.rpc_proc = &rpcb_procedures2[RPCBPROC_SET]; |
| 290 | 330 | ||
| 291 | return rpcb_register_call(RPCBVERS_2, &msg); | 331 | return rpcb_register_call(rpcb_local_clnt, &msg); |
| 292 | } | 332 | } |
| 293 | 333 | ||
| 294 | /* | 334 | /* |
| @@ -313,7 +353,7 @@ static int rpcb_register_inet4(const struct sockaddr *sap, | |||
| 313 | if (port) | 353 | if (port) |
| 314 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; | 354 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; |
| 315 | 355 | ||
| 316 | result = rpcb_register_call(RPCBVERS_4, msg); | 356 | result = rpcb_register_call(rpcb_local_clnt4, msg); |
| 317 | kfree(map->r_addr); | 357 | kfree(map->r_addr); |
| 318 | return result; | 358 | return result; |
| 319 | } | 359 | } |
| @@ -340,7 +380,7 @@ static int rpcb_register_inet6(const struct sockaddr *sap, | |||
| 340 | if (port) | 380 | if (port) |
| 341 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; | 381 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; |
| 342 | 382 | ||
| 343 | result = rpcb_register_call(RPCBVERS_4, msg); | 383 | result = rpcb_register_call(rpcb_local_clnt4, msg); |
| 344 | kfree(map->r_addr); | 384 | kfree(map->r_addr); |
| 345 | return result; | 385 | return result; |
| 346 | } | 386 | } |
| @@ -356,7 +396,7 @@ static int rpcb_unregister_all_protofamilies(struct rpc_message *msg) | |||
| 356 | map->r_addr = ""; | 396 | map->r_addr = ""; |
| 357 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; | 397 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; |
| 358 | 398 | ||
| 359 | return rpcb_register_call(RPCBVERS_4, msg); | 399 | return rpcb_register_call(rpcb_local_clnt4, msg); |
| 360 | } | 400 | } |
| 361 | 401 | ||
| 362 | /** | 402 | /** |
| @@ -414,6 +454,13 @@ int rpcb_v4_register(const u32 program, const u32 version, | |||
| 414 | struct rpc_message msg = { | 454 | struct rpc_message msg = { |
| 415 | .rpc_argp = &map, | 455 | .rpc_argp = &map, |
| 416 | }; | 456 | }; |
| 457 | int error; | ||
| 458 | |||
| 459 | error = rpcb_create_local(); | ||
| 460 | if (error) | ||
| 461 | return error; | ||
| 462 | if (rpcb_local_clnt4 == NULL) | ||
| 463 | return -EPROTONOSUPPORT; | ||
| 417 | 464 | ||
| 418 | if (address == NULL) | 465 | if (address == NULL) |
| 419 | return rpcb_unregister_all_protofamilies(&msg); | 466 | return rpcb_unregister_all_protofamilies(&msg); |
| @@ -491,7 +538,7 @@ static struct rpc_task *rpcb_call_async(struct rpc_clnt *rpcb_clnt, struct rpcbi | |||
| 491 | .rpc_message = &msg, | 538 | .rpc_message = &msg, |
| 492 | .callback_ops = &rpcb_getport_ops, | 539 | .callback_ops = &rpcb_getport_ops, |
| 493 | .callback_data = map, | 540 | .callback_data = map, |
| 494 | .flags = RPC_TASK_ASYNC, | 541 | .flags = RPC_TASK_ASYNC | RPC_TASK_SOFTCONN, |
| 495 | }; | 542 | }; |
| 496 | 543 | ||
| 497 | return rpc_run_task(&task_setup_data); | 544 | return rpc_run_task(&task_setup_data); |
| @@ -1027,3 +1074,15 @@ static struct rpc_program rpcb_program = { | |||
| 1027 | .version = rpcb_version, | 1074 | .version = rpcb_version, |
| 1028 | .stats = &rpcb_stats, | 1075 | .stats = &rpcb_stats, |
| 1029 | }; | 1076 | }; |
| 1077 | |||
| 1078 | /** | ||
| 1079 | * cleanup_rpcb_clnt - remove xprtsock's sysctls, unregister | ||
| 1080 | * | ||
| 1081 | */ | ||
| 1082 | void cleanup_rpcb_clnt(void) | ||
| 1083 | { | ||
| 1084 | if (rpcb_local_clnt4) | ||
| 1085 | rpc_shutdown_client(rpcb_local_clnt4); | ||
| 1086 | if (rpcb_local_clnt) | ||
| 1087 | rpc_shutdown_client(rpcb_local_clnt); | ||
| 1088 | } | ||
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index cef74ba0666c..aae6907fd546 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
| @@ -210,6 +210,7 @@ void rpc_init_priority_wait_queue(struct rpc_wait_queue *queue, const char *qnam | |||
| 210 | { | 210 | { |
| 211 | __rpc_init_priority_wait_queue(queue, qname, RPC_NR_PRIORITY); | 211 | __rpc_init_priority_wait_queue(queue, qname, RPC_NR_PRIORITY); |
| 212 | } | 212 | } |
| 213 | EXPORT_SYMBOL_GPL(rpc_init_priority_wait_queue); | ||
| 213 | 214 | ||
| 214 | void rpc_init_wait_queue(struct rpc_wait_queue *queue, const char *qname) | 215 | void rpc_init_wait_queue(struct rpc_wait_queue *queue, const char *qname) |
| 215 | { | 216 | { |
| @@ -385,6 +386,20 @@ static void rpc_wake_up_task_queue_locked(struct rpc_wait_queue *queue, struct r | |||
| 385 | } | 386 | } |
| 386 | 387 | ||
| 387 | /* | 388 | /* |
| 389 | * Tests whether rpc queue is empty | ||
| 390 | */ | ||
| 391 | int rpc_queue_empty(struct rpc_wait_queue *queue) | ||
| 392 | { | ||
| 393 | int res; | ||
| 394 | |||
| 395 | spin_lock_bh(&queue->lock); | ||
| 396 | res = queue->qlen; | ||
| 397 | spin_unlock_bh(&queue->lock); | ||
| 398 | return (res == 0); | ||
| 399 | } | ||
| 400 | EXPORT_SYMBOL_GPL(rpc_queue_empty); | ||
| 401 | |||
| 402 | /* | ||
| 388 | * Wake up a task on a specific queue | 403 | * Wake up a task on a specific queue |
| 389 | */ | 404 | */ |
| 390 | void rpc_wake_up_queued_task(struct rpc_wait_queue *queue, struct rpc_task *task) | 405 | void rpc_wake_up_queued_task(struct rpc_wait_queue *queue, struct rpc_task *task) |
diff --git a/net/sunrpc/socklib.c b/net/sunrpc/socklib.c index a661a3acb37e..10b4319ebbca 100644 --- a/net/sunrpc/socklib.c +++ b/net/sunrpc/socklib.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | 8 | ||
| 9 | #include <linux/compiler.h> | 9 | #include <linux/compiler.h> |
| 10 | #include <linux/netdevice.h> | 10 | #include <linux/netdevice.h> |
| 11 | #include <linux/gfp.h> | ||
| 11 | #include <linux/skbuff.h> | 12 | #include <linux/skbuff.h> |
| 12 | #include <linux/types.h> | 13 | #include <linux/types.h> |
| 13 | #include <linux/pagemap.h> | 14 | #include <linux/pagemap.h> |
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 1b4e6791ecf3..5785d2037f45 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| 16 | #include <linux/slab.h> | ||
| 16 | 17 | ||
| 17 | #include <linux/init.h> | 18 | #include <linux/init.h> |
| 18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c index 8cce92189019..f438347d817b 100644 --- a/net/sunrpc/sunrpc_syms.c +++ b/net/sunrpc/sunrpc_syms.c | |||
| @@ -24,6 +24,8 @@ | |||
| 24 | 24 | ||
| 25 | extern struct cache_detail ip_map_cache, unix_gid_cache; | 25 | extern struct cache_detail ip_map_cache, unix_gid_cache; |
| 26 | 26 | ||
| 27 | extern void cleanup_rpcb_clnt(void); | ||
| 28 | |||
| 27 | static int __init | 29 | static int __init |
| 28 | init_sunrpc(void) | 30 | init_sunrpc(void) |
| 29 | { | 31 | { |
| @@ -53,6 +55,7 @@ out: | |||
| 53 | static void __exit | 55 | static void __exit |
| 54 | cleanup_sunrpc(void) | 56 | cleanup_sunrpc(void) |
| 55 | { | 57 | { |
| 58 | cleanup_rpcb_clnt(); | ||
| 56 | rpcauth_remove_module(); | 59 | rpcauth_remove_module(); |
| 57 | cleanup_socket_xprt(); | 60 | cleanup_socket_xprt(); |
| 58 | svc_cleanup_xprt_sock(); | 61 | svc_cleanup_xprt_sock(); |
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 952f206ff307..d9017d64597e 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
| 20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 21 | #include <linux/kthread.h> | 21 | #include <linux/kthread.h> |
| 22 | #include <linux/slab.h> | ||
| 22 | 23 | ||
| 23 | #include <linux/sunrpc/types.h> | 24 | #include <linux/sunrpc/types.h> |
| 24 | #include <linux/sunrpc/xdr.h> | 25 | #include <linux/sunrpc/xdr.h> |
| @@ -133,7 +134,7 @@ svc_pool_map_choose_mode(void) | |||
| 133 | return SVC_POOL_PERNODE; | 134 | return SVC_POOL_PERNODE; |
| 134 | } | 135 | } |
| 135 | 136 | ||
| 136 | node = any_online_node(node_online_map); | 137 | node = first_online_node; |
| 137 | if (nr_cpus_node(node) > 2) { | 138 | if (nr_cpus_node(node) > 2) { |
| 138 | /* | 139 | /* |
| 139 | * Non-trivial SMP, or CONFIG_NUMA on | 140 | * Non-trivial SMP, or CONFIG_NUMA on |
| @@ -506,6 +507,10 @@ svc_init_buffer(struct svc_rqst *rqstp, unsigned int size) | |||
| 506 | { | 507 | { |
| 507 | unsigned int pages, arghi; | 508 | unsigned int pages, arghi; |
| 508 | 509 | ||
| 510 | /* bc_xprt uses fore channel allocated buffers */ | ||
| 511 | if (svc_is_backchannel(rqstp)) | ||
| 512 | return 1; | ||
| 513 | |||
| 509 | pages = size / PAGE_SIZE + 1; /* extra page as we hold both request and reply. | 514 | pages = size / PAGE_SIZE + 1; /* extra page as we hold both request and reply. |
| 510 | * We assume one is at most one page | 515 | * We assume one is at most one page |
| 511 | */ | 516 | */ |
| @@ -1103,8 +1108,9 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) | |||
| 1103 | procp->pc_release(rqstp, NULL, rqstp->rq_resp); | 1108 | procp->pc_release(rqstp, NULL, rqstp->rq_resp); |
| 1104 | goto dropit; | 1109 | goto dropit; |
| 1105 | } | 1110 | } |
| 1106 | if (*statp == rpc_success && (xdr = procp->pc_encode) | 1111 | if (*statp == rpc_success && |
| 1107 | && !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) { | 1112 | (xdr = procp->pc_encode) && |
| 1113 | !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) { | ||
| 1108 | dprintk("svc: failed to encode reply\n"); | 1114 | dprintk("svc: failed to encode reply\n"); |
| 1109 | /* serv->sv_stats->rpcsystemerr++; */ | 1115 | /* serv->sv_stats->rpcsystemerr++; */ |
| 1110 | *statp = rpc_system_err; | 1116 | *statp = rpc_system_err; |
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index df124f78ee48..061b2e0f9118 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <linux/errno.h> | 9 | #include <linux/errno.h> |
| 10 | #include <linux/freezer.h> | 10 | #include <linux/freezer.h> |
| 11 | #include <linux/kthread.h> | 11 | #include <linux/kthread.h> |
| 12 | #include <linux/slab.h> | ||
| 12 | #include <net/sock.h> | 13 | #include <net/sock.h> |
| 13 | #include <linux/sunrpc/stats.h> | 14 | #include <linux/sunrpc/stats.h> |
| 14 | #include <linux/sunrpc/svc_xprt.h> | 15 | #include <linux/sunrpc/svc_xprt.h> |
| @@ -16,8 +17,6 @@ | |||
| 16 | 17 | ||
| 17 | #define RPCDBG_FACILITY RPCDBG_SVCXPRT | 18 | #define RPCDBG_FACILITY RPCDBG_SVCXPRT |
| 18 | 19 | ||
| 19 | #define SVC_MAX_WAKING 5 | ||
| 20 | |||
| 21 | static struct svc_deferred_req *svc_deferred_dequeue(struct svc_xprt *xprt); | 20 | static struct svc_deferred_req *svc_deferred_dequeue(struct svc_xprt *xprt); |
| 22 | static int svc_deferred_recv(struct svc_rqst *rqstp); | 21 | static int svc_deferred_recv(struct svc_rqst *rqstp); |
| 23 | static struct cache_deferred_req *svc_defer(struct cache_req *req); | 22 | static struct cache_deferred_req *svc_defer(struct cache_req *req); |
| @@ -129,8 +128,8 @@ static void svc_xprt_free(struct kref *kref) | |||
| 129 | struct svc_xprt *xprt = | 128 | struct svc_xprt *xprt = |
| 130 | container_of(kref, struct svc_xprt, xpt_ref); | 129 | container_of(kref, struct svc_xprt, xpt_ref); |
| 131 | struct module *owner = xprt->xpt_class->xcl_owner; | 130 | struct module *owner = xprt->xpt_class->xcl_owner; |
| 132 | if (test_bit(XPT_CACHE_AUTH, &xprt->xpt_flags) | 131 | if (test_bit(XPT_CACHE_AUTH, &xprt->xpt_flags) && |
| 133 | && xprt->xpt_auth_cache != NULL) | 132 | xprt->xpt_auth_cache != NULL) |
| 134 | svcauth_unix_info_release(xprt->xpt_auth_cache); | 133 | svcauth_unix_info_release(xprt->xpt_auth_cache); |
| 135 | xprt->xpt_ops->xpo_free(xprt); | 134 | xprt->xpt_ops->xpo_free(xprt); |
| 136 | module_put(owner); | 135 | module_put(owner); |
| @@ -175,11 +174,13 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl, | |||
| 175 | .sin_addr.s_addr = htonl(INADDR_ANY), | 174 | .sin_addr.s_addr = htonl(INADDR_ANY), |
| 176 | .sin_port = htons(port), | 175 | .sin_port = htons(port), |
| 177 | }; | 176 | }; |
| 177 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
| 178 | struct sockaddr_in6 sin6 = { | 178 | struct sockaddr_in6 sin6 = { |
| 179 | .sin6_family = AF_INET6, | 179 | .sin6_family = AF_INET6, |
| 180 | .sin6_addr = IN6ADDR_ANY_INIT, | 180 | .sin6_addr = IN6ADDR_ANY_INIT, |
| 181 | .sin6_port = htons(port), | 181 | .sin6_port = htons(port), |
| 182 | }; | 182 | }; |
| 183 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | ||
| 183 | struct sockaddr *sap; | 184 | struct sockaddr *sap; |
| 184 | size_t len; | 185 | size_t len; |
| 185 | 186 | ||
| @@ -188,10 +189,12 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl, | |||
| 188 | sap = (struct sockaddr *)&sin; | 189 | sap = (struct sockaddr *)&sin; |
| 189 | len = sizeof(sin); | 190 | len = sizeof(sin); |
| 190 | break; | 191 | break; |
| 192 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
| 191 | case PF_INET6: | 193 | case PF_INET6: |
| 192 | sap = (struct sockaddr *)&sin6; | 194 | sap = (struct sockaddr *)&sin6; |
| 193 | len = sizeof(sin6); | 195 | len = sizeof(sin6); |
| 194 | break; | 196 | break; |
| 197 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | ||
| 195 | default: | 198 | default: |
| 196 | return ERR_PTR(-EAFNOSUPPORT); | 199 | return ERR_PTR(-EAFNOSUPPORT); |
| 197 | } | 200 | } |
| @@ -233,7 +236,10 @@ int svc_create_xprt(struct svc_serv *serv, const char *xprt_name, | |||
| 233 | err: | 236 | err: |
| 234 | spin_unlock(&svc_xprt_class_lock); | 237 | spin_unlock(&svc_xprt_class_lock); |
| 235 | dprintk("svc: transport %s not found\n", xprt_name); | 238 | dprintk("svc: transport %s not found\n", xprt_name); |
| 236 | return -ENOENT; | 239 | |
| 240 | /* This errno is exposed to user space. Provide a reasonable | ||
| 241 | * perror msg for a bad transport. */ | ||
| 242 | return -EPROTONOSUPPORT; | ||
| 237 | } | 243 | } |
| 238 | EXPORT_SYMBOL_GPL(svc_create_xprt); | 244 | EXPORT_SYMBOL_GPL(svc_create_xprt); |
| 239 | 245 | ||
| @@ -306,7 +312,6 @@ void svc_xprt_enqueue(struct svc_xprt *xprt) | |||
| 306 | struct svc_pool *pool; | 312 | struct svc_pool *pool; |
| 307 | struct svc_rqst *rqstp; | 313 | struct svc_rqst *rqstp; |
| 308 | int cpu; | 314 | int cpu; |
| 309 | int thread_avail; | ||
| 310 | 315 | ||
| 311 | if (!(xprt->xpt_flags & | 316 | if (!(xprt->xpt_flags & |
| 312 | ((1<<XPT_CONN)|(1<<XPT_DATA)|(1<<XPT_CLOSE)|(1<<XPT_DEFERRED)))) | 317 | ((1<<XPT_CONN)|(1<<XPT_DATA)|(1<<XPT_CLOSE)|(1<<XPT_DEFERRED)))) |
| @@ -318,6 +323,12 @@ void svc_xprt_enqueue(struct svc_xprt *xprt) | |||
| 318 | 323 | ||
| 319 | spin_lock_bh(&pool->sp_lock); | 324 | spin_lock_bh(&pool->sp_lock); |
| 320 | 325 | ||
| 326 | if (!list_empty(&pool->sp_threads) && | ||
| 327 | !list_empty(&pool->sp_sockets)) | ||
| 328 | printk(KERN_ERR | ||
| 329 | "svc_xprt_enqueue: " | ||
| 330 | "threads and transports both waiting??\n"); | ||
| 331 | |||
| 321 | if (test_bit(XPT_DEAD, &xprt->xpt_flags)) { | 332 | if (test_bit(XPT_DEAD, &xprt->xpt_flags)) { |
| 322 | /* Don't enqueue dead transports */ | 333 | /* Don't enqueue dead transports */ |
| 323 | dprintk("svc: transport %p is dead, not enqueued\n", xprt); | 334 | dprintk("svc: transport %p is dead, not enqueued\n", xprt); |
| @@ -358,15 +369,7 @@ void svc_xprt_enqueue(struct svc_xprt *xprt) | |||
| 358 | } | 369 | } |
| 359 | 370 | ||
| 360 | process: | 371 | process: |
| 361 | /* Work out whether threads are available */ | 372 | if (!list_empty(&pool->sp_threads)) { |
| 362 | thread_avail = !list_empty(&pool->sp_threads); /* threads are asleep */ | ||
| 363 | if (pool->sp_nwaking >= SVC_MAX_WAKING) { | ||
| 364 | /* too many threads are runnable and trying to wake up */ | ||
| 365 | thread_avail = 0; | ||
| 366 | pool->sp_stats.overloads_avoided++; | ||
| 367 | } | ||
| 368 | |||
| 369 | if (thread_avail) { | ||
| 370 | rqstp = list_entry(pool->sp_threads.next, | 373 | rqstp = list_entry(pool->sp_threads.next, |
| 371 | struct svc_rqst, | 374 | struct svc_rqst, |
| 372 | rq_list); | 375 | rq_list); |
| @@ -381,8 +384,6 @@ void svc_xprt_enqueue(struct svc_xprt *xprt) | |||
| 381 | svc_xprt_get(xprt); | 384 | svc_xprt_get(xprt); |
| 382 | rqstp->rq_reserved = serv->sv_max_mesg; | 385 | rqstp->rq_reserved = serv->sv_max_mesg; |
| 383 | atomic_add(rqstp->rq_reserved, &xprt->xpt_reserved); | 386 | atomic_add(rqstp->rq_reserved, &xprt->xpt_reserved); |
| 384 | rqstp->rq_waking = 1; | ||
| 385 | pool->sp_nwaking++; | ||
| 386 | pool->sp_stats.threads_woken++; | 387 | pool->sp_stats.threads_woken++; |
| 387 | BUG_ON(xprt->xpt_pool != pool); | 388 | BUG_ON(xprt->xpt_pool != pool); |
| 388 | wake_up(&rqstp->rq_wait); | 389 | wake_up(&rqstp->rq_wait); |
| @@ -651,11 +652,6 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) | |||
| 651 | return -EINTR; | 652 | return -EINTR; |
| 652 | 653 | ||
| 653 | spin_lock_bh(&pool->sp_lock); | 654 | spin_lock_bh(&pool->sp_lock); |
| 654 | if (rqstp->rq_waking) { | ||
| 655 | rqstp->rq_waking = 0; | ||
| 656 | pool->sp_nwaking--; | ||
| 657 | BUG_ON(pool->sp_nwaking < 0); | ||
| 658 | } | ||
| 659 | xprt = svc_xprt_dequeue(pool); | 655 | xprt = svc_xprt_dequeue(pool); |
| 660 | if (xprt) { | 656 | if (xprt) { |
| 661 | rqstp->rq_xprt = xprt; | 657 | rqstp->rq_xprt = xprt; |
| @@ -711,7 +707,10 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) | |||
| 711 | spin_unlock_bh(&pool->sp_lock); | 707 | spin_unlock_bh(&pool->sp_lock); |
| 712 | 708 | ||
| 713 | len = 0; | 709 | len = 0; |
| 714 | if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) { | 710 | if (test_bit(XPT_CLOSE, &xprt->xpt_flags)) { |
| 711 | dprintk("svc_recv: found XPT_CLOSE\n"); | ||
| 712 | svc_delete_xprt(xprt); | ||
| 713 | } else if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) { | ||
| 715 | struct svc_xprt *newxpt; | 714 | struct svc_xprt *newxpt; |
| 716 | newxpt = xprt->xpt_ops->xpo_accept(xprt); | 715 | newxpt = xprt->xpt_ops->xpo_accept(xprt); |
| 717 | if (newxpt) { | 716 | if (newxpt) { |
| @@ -737,7 +736,7 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) | |||
| 737 | svc_xprt_received(newxpt); | 736 | svc_xprt_received(newxpt); |
| 738 | } | 737 | } |
| 739 | svc_xprt_received(xprt); | 738 | svc_xprt_received(xprt); |
| 740 | } else if (!test_bit(XPT_CLOSE, &xprt->xpt_flags)) { | 739 | } else { |
| 741 | dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n", | 740 | dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n", |
| 742 | rqstp, pool->sp_id, xprt, | 741 | rqstp, pool->sp_id, xprt, |
| 743 | atomic_read(&xprt->xpt_ref.refcount)); | 742 | atomic_read(&xprt->xpt_ref.refcount)); |
| @@ -750,11 +749,6 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) | |||
| 750 | dprintk("svc: got len=%d\n", len); | 749 | dprintk("svc: got len=%d\n", len); |
| 751 | } | 750 | } |
| 752 | 751 | ||
| 753 | if (test_bit(XPT_CLOSE, &xprt->xpt_flags)) { | ||
| 754 | dprintk("svc_recv: found XPT_CLOSE\n"); | ||
| 755 | svc_delete_xprt(xprt); | ||
| 756 | } | ||
| 757 | |||
| 758 | /* No data, incomplete (TCP) read, or accept() */ | 752 | /* No data, incomplete (TCP) read, or accept() */ |
| 759 | if (len == 0 || len == -EAGAIN) { | 753 | if (len == 0 || len == -EAGAIN) { |
| 760 | rqstp->rq_res.len = 0; | 754 | rqstp->rq_res.len = 0; |
| @@ -846,8 +840,8 @@ static void svc_age_temp_xprts(unsigned long closure) | |||
| 846 | * through, close it. */ | 840 | * through, close it. */ |
| 847 | if (!test_and_set_bit(XPT_OLD, &xprt->xpt_flags)) | 841 | if (!test_and_set_bit(XPT_OLD, &xprt->xpt_flags)) |
| 848 | continue; | 842 | continue; |
| 849 | if (atomic_read(&xprt->xpt_ref.refcount) > 1 | 843 | if (atomic_read(&xprt->xpt_ref.refcount) > 1 || |
| 850 | || test_bit(XPT_BUSY, &xprt->xpt_flags)) | 844 | test_bit(XPT_BUSY, &xprt->xpt_flags)) |
| 851 | continue; | 845 | continue; |
| 852 | svc_xprt_get(xprt); | 846 | svc_xprt_get(xprt); |
| 853 | list_move(le, &to_be_aged); | 847 | list_move(le, &to_be_aged); |
| @@ -900,11 +894,8 @@ void svc_delete_xprt(struct svc_xprt *xprt) | |||
| 900 | if (test_bit(XPT_TEMP, &xprt->xpt_flags)) | 894 | if (test_bit(XPT_TEMP, &xprt->xpt_flags)) |
| 901 | serv->sv_tmpcnt--; | 895 | serv->sv_tmpcnt--; |
| 902 | 896 | ||
| 903 | for (dr = svc_deferred_dequeue(xprt); dr; | 897 | while ((dr = svc_deferred_dequeue(xprt)) != NULL) |
| 904 | dr = svc_deferred_dequeue(xprt)) { | ||
| 905 | svc_xprt_put(xprt); | ||
| 906 | kfree(dr); | 898 | kfree(dr); |
| 907 | } | ||
| 908 | 899 | ||
| 909 | svc_xprt_put(xprt); | 900 | svc_xprt_put(xprt); |
| 910 | spin_unlock_bh(&serv->sv_lock); | 901 | spin_unlock_bh(&serv->sv_lock); |
| @@ -1204,16 +1195,15 @@ static int svc_pool_stats_show(struct seq_file *m, void *p) | |||
| 1204 | struct svc_pool *pool = p; | 1195 | struct svc_pool *pool = p; |
| 1205 | 1196 | ||
| 1206 | if (p == SEQ_START_TOKEN) { | 1197 | if (p == SEQ_START_TOKEN) { |
| 1207 | seq_puts(m, "# pool packets-arrived sockets-enqueued threads-woken overloads-avoided threads-timedout\n"); | 1198 | seq_puts(m, "# pool packets-arrived sockets-enqueued threads-woken threads-timedout\n"); |
| 1208 | return 0; | 1199 | return 0; |
| 1209 | } | 1200 | } |
| 1210 | 1201 | ||
| 1211 | seq_printf(m, "%u %lu %lu %lu %lu %lu\n", | 1202 | seq_printf(m, "%u %lu %lu %lu %lu\n", |
| 1212 | pool->sp_id, | 1203 | pool->sp_id, |
| 1213 | pool->sp_stats.packets, | 1204 | pool->sp_stats.packets, |
| 1214 | pool->sp_stats.sockets_queued, | 1205 | pool->sp_stats.sockets_queued, |
| 1215 | pool->sp_stats.threads_woken, | 1206 | pool->sp_stats.threads_woken, |
| 1216 | pool->sp_stats.overloads_avoided, | ||
| 1217 | pool->sp_stats.threads_timedout); | 1207 | pool->sp_stats.threads_timedout); |
| 1218 | 1208 | ||
| 1219 | return 0; | 1209 | return 0; |
diff --git a/net/sunrpc/svcauth.c b/net/sunrpc/svcauth.c index e64109b02aee..4e9393c24687 100644 --- a/net/sunrpc/svcauth.c +++ b/net/sunrpc/svcauth.c | |||
| @@ -46,8 +46,8 @@ svc_authenticate(struct svc_rqst *rqstp, __be32 *authp) | |||
| 46 | dprintk("svc: svc_authenticate (%d)\n", flavor); | 46 | dprintk("svc: svc_authenticate (%d)\n", flavor); |
| 47 | 47 | ||
| 48 | spin_lock(&authtab_lock); | 48 | spin_lock(&authtab_lock); |
| 49 | if (flavor >= RPC_AUTH_MAXFLAVOR || !(aops = authtab[flavor]) | 49 | if (flavor >= RPC_AUTH_MAXFLAVOR || !(aops = authtab[flavor]) || |
| 50 | || !try_module_get(aops->owner)) { | 50 | !try_module_get(aops->owner)) { |
| 51 | spin_unlock(&authtab_lock); | 51 | spin_unlock(&authtab_lock); |
| 52 | *authp = rpc_autherr_badcred; | 52 | *authp = rpc_autherr_badcred; |
| 53 | return SVC_DENIED; | 53 | return SVC_DENIED; |
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 117f68a8aa40..207311610988 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
| @@ -10,11 +10,13 @@ | |||
| 10 | #include <linux/seq_file.h> | 10 | #include <linux/seq_file.h> |
| 11 | #include <linux/hash.h> | 11 | #include <linux/hash.h> |
| 12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
| 13 | #include <linux/slab.h> | ||
| 13 | #include <net/sock.h> | 14 | #include <net/sock.h> |
| 14 | #include <net/ipv6.h> | 15 | #include <net/ipv6.h> |
| 15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
| 16 | #define RPCDBG_FACILITY RPCDBG_AUTH | 17 | #define RPCDBG_FACILITY RPCDBG_AUTH |
| 17 | 18 | ||
| 19 | #include <linux/sunrpc/clnt.h> | ||
| 18 | 20 | ||
| 19 | /* | 21 | /* |
| 20 | * AUTHUNIX and AUTHNULL credentials are both handled here. | 22 | * AUTHUNIX and AUTHNULL credentials are both handled here. |
| @@ -125,8 +127,8 @@ static int ip_map_match(struct cache_head *corig, struct cache_head *cnew) | |||
| 125 | { | 127 | { |
| 126 | struct ip_map *orig = container_of(corig, struct ip_map, h); | 128 | struct ip_map *orig = container_of(corig, struct ip_map, h); |
| 127 | struct ip_map *new = container_of(cnew, struct ip_map, h); | 129 | struct ip_map *new = container_of(cnew, struct ip_map, h); |
| 128 | return strcmp(orig->m_class, new->m_class) == 0 | 130 | return strcmp(orig->m_class, new->m_class) == 0 && |
| 129 | && ipv6_addr_equal(&orig->m_addr, &new->m_addr); | 131 | ipv6_addr_equal(&orig->m_addr, &new->m_addr); |
| 130 | } | 132 | } |
| 131 | static void ip_map_init(struct cache_head *cnew, struct cache_head *citem) | 133 | static void ip_map_init(struct cache_head *cnew, struct cache_head *citem) |
| 132 | { | 134 | { |
| @@ -187,10 +189,13 @@ static int ip_map_parse(struct cache_detail *cd, | |||
| 187 | * for scratch: */ | 189 | * for scratch: */ |
| 188 | char *buf = mesg; | 190 | char *buf = mesg; |
| 189 | int len; | 191 | int len; |
| 190 | int b1, b2, b3, b4, b5, b6, b7, b8; | ||
| 191 | char c; | ||
| 192 | char class[8]; | 192 | char class[8]; |
| 193 | struct in6_addr addr; | 193 | union { |
| 194 | struct sockaddr sa; | ||
| 195 | struct sockaddr_in s4; | ||
| 196 | struct sockaddr_in6 s6; | ||
| 197 | } address; | ||
| 198 | struct sockaddr_in6 sin6; | ||
| 194 | int err; | 199 | int err; |
| 195 | 200 | ||
| 196 | struct ip_map *ipmp; | 201 | struct ip_map *ipmp; |
| @@ -209,24 +214,24 @@ static int ip_map_parse(struct cache_detail *cd, | |||
| 209 | len = qword_get(&mesg, buf, mlen); | 214 | len = qword_get(&mesg, buf, mlen); |
| 210 | if (len <= 0) return -EINVAL; | 215 | if (len <= 0) return -EINVAL; |
| 211 | 216 | ||
| 212 | if (sscanf(buf, "%u.%u.%u.%u%c", &b1, &b2, &b3, &b4, &c) == 4) { | 217 | if (rpc_pton(buf, len, &address.sa, sizeof(address)) == 0) |
| 213 | addr.s6_addr32[0] = 0; | 218 | return -EINVAL; |
| 214 | addr.s6_addr32[1] = 0; | 219 | switch (address.sa.sa_family) { |
| 215 | addr.s6_addr32[2] = htonl(0xffff); | 220 | case AF_INET: |
| 216 | addr.s6_addr32[3] = | 221 | /* Form a mapped IPv4 address in sin6 */ |
| 217 | htonl((((((b1<<8)|b2)<<8)|b3)<<8)|b4); | 222 | memset(&sin6, 0, sizeof(sin6)); |
| 218 | } else if (sscanf(buf, "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x%c", | 223 | sin6.sin6_family = AF_INET6; |
| 219 | &b1, &b2, &b3, &b4, &b5, &b6, &b7, &b8, &c) == 8) { | 224 | sin6.sin6_addr.s6_addr32[2] = htonl(0xffff); |
| 220 | addr.s6_addr16[0] = htons(b1); | 225 | sin6.sin6_addr.s6_addr32[3] = address.s4.sin_addr.s_addr; |
| 221 | addr.s6_addr16[1] = htons(b2); | 226 | break; |
| 222 | addr.s6_addr16[2] = htons(b3); | 227 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
| 223 | addr.s6_addr16[3] = htons(b4); | 228 | case AF_INET6: |
| 224 | addr.s6_addr16[4] = htons(b5); | 229 | memcpy(&sin6, &address.s6, sizeof(sin6)); |
| 225 | addr.s6_addr16[5] = htons(b6); | 230 | break; |
| 226 | addr.s6_addr16[6] = htons(b7); | 231 | #endif |
| 227 | addr.s6_addr16[7] = htons(b8); | 232 | default: |
| 228 | } else | ||
| 229 | return -EINVAL; | 233 | return -EINVAL; |
| 234 | } | ||
| 230 | 235 | ||
| 231 | expiry = get_expiry(&mesg); | 236 | expiry = get_expiry(&mesg); |
| 232 | if (expiry ==0) | 237 | if (expiry ==0) |
| @@ -243,7 +248,8 @@ static int ip_map_parse(struct cache_detail *cd, | |||
| 243 | } else | 248 | } else |
| 244 | dom = NULL; | 249 | dom = NULL; |
| 245 | 250 | ||
| 246 | ipmp = ip_map_lookup(class, &addr); | 251 | /* IPv6 scope IDs are ignored for now */ |
| 252 | ipmp = ip_map_lookup(class, &sin6.sin6_addr); | ||
| 247 | if (ipmp) { | 253 | if (ipmp) { |
| 248 | err = ip_map_update(ipmp, | 254 | err = ip_map_update(ipmp, |
| 249 | container_of(dom, struct unix_domain, h), | 255 | container_of(dom, struct unix_domain, h), |
| @@ -619,7 +625,7 @@ static int unix_gid_show(struct seq_file *m, | |||
| 619 | else | 625 | else |
| 620 | glen = 0; | 626 | glen = 0; |
| 621 | 627 | ||
| 622 | seq_printf(m, "%d %d:", ug->uid, glen); | 628 | seq_printf(m, "%u %d:", ug->uid, glen); |
| 623 | for (i = 0; i < glen; i++) | 629 | for (i = 0; i < glen; i++) |
| 624 | seq_printf(m, " %d", GROUP_AT(ug->gi, i)); | 630 | seq_printf(m, " %d", GROUP_AT(ug->gi, i)); |
| 625 | seq_printf(m, "\n"); | 631 | seq_printf(m, "\n"); |
| @@ -655,23 +661,25 @@ static struct unix_gid *unix_gid_lookup(uid_t uid) | |||
| 655 | return NULL; | 661 | return NULL; |
| 656 | } | 662 | } |
| 657 | 663 | ||
| 658 | static int unix_gid_find(uid_t uid, struct group_info **gip, | 664 | static struct group_info *unix_gid_find(uid_t uid, struct svc_rqst *rqstp) |
| 659 | struct svc_rqst *rqstp) | ||
| 660 | { | 665 | { |
| 661 | struct unix_gid *ug = unix_gid_lookup(uid); | 666 | struct unix_gid *ug; |
| 667 | struct group_info *gi; | ||
| 668 | int ret; | ||
| 669 | |||
| 670 | ug = unix_gid_lookup(uid); | ||
| 662 | if (!ug) | 671 | if (!ug) |
| 663 | return -EAGAIN; | 672 | return ERR_PTR(-EAGAIN); |
| 664 | switch (cache_check(&unix_gid_cache, &ug->h, &rqstp->rq_chandle)) { | 673 | ret = cache_check(&unix_gid_cache, &ug->h, &rqstp->rq_chandle); |
| 674 | switch (ret) { | ||
| 665 | case -ENOENT: | 675 | case -ENOENT: |
| 666 | *gip = NULL; | 676 | return ERR_PTR(-ENOENT); |
| 667 | return 0; | ||
| 668 | case 0: | 677 | case 0: |
| 669 | *gip = ug->gi; | 678 | gi = get_group_info(ug->gi); |
| 670 | get_group_info(*gip); | ||
| 671 | cache_put(&ug->h, &unix_gid_cache); | 679 | cache_put(&ug->h, &unix_gid_cache); |
| 672 | return 0; | 680 | return gi; |
| 673 | default: | 681 | default: |
| 674 | return -EAGAIN; | 682 | return ERR_PTR(-EAGAIN); |
| 675 | } | 683 | } |
| 676 | } | 684 | } |
| 677 | 685 | ||
| @@ -681,13 +689,14 @@ svcauth_unix_set_client(struct svc_rqst *rqstp) | |||
| 681 | struct sockaddr_in *sin; | 689 | struct sockaddr_in *sin; |
| 682 | struct sockaddr_in6 *sin6, sin6_storage; | 690 | struct sockaddr_in6 *sin6, sin6_storage; |
| 683 | struct ip_map *ipm; | 691 | struct ip_map *ipm; |
| 692 | struct group_info *gi; | ||
| 693 | struct svc_cred *cred = &rqstp->rq_cred; | ||
| 684 | 694 | ||
| 685 | switch (rqstp->rq_addr.ss_family) { | 695 | switch (rqstp->rq_addr.ss_family) { |
| 686 | case AF_INET: | 696 | case AF_INET: |
| 687 | sin = svc_addr_in(rqstp); | 697 | sin = svc_addr_in(rqstp); |
| 688 | sin6 = &sin6_storage; | 698 | sin6 = &sin6_storage; |
| 689 | ipv6_addr_set(&sin6->sin6_addr, 0, 0, | 699 | ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &sin6->sin6_addr); |
| 690 | htonl(0x0000FFFF), sin->sin_addr.s_addr); | ||
| 691 | break; | 700 | break; |
| 692 | case AF_INET6: | 701 | case AF_INET6: |
| 693 | sin6 = svc_addr_in6(rqstp); | 702 | sin6 = svc_addr_in6(rqstp); |
| @@ -722,6 +731,17 @@ svcauth_unix_set_client(struct svc_rqst *rqstp) | |||
| 722 | ip_map_cached_put(rqstp, ipm); | 731 | ip_map_cached_put(rqstp, ipm); |
| 723 | break; | 732 | break; |
| 724 | } | 733 | } |
| 734 | |||
| 735 | gi = unix_gid_find(cred->cr_uid, rqstp); | ||
| 736 | switch (PTR_ERR(gi)) { | ||
| 737 | case -EAGAIN: | ||
| 738 | return SVC_DROP; | ||
| 739 | case -ENOENT: | ||
| 740 | break; | ||
| 741 | default: | ||
| 742 | put_group_info(cred->cr_group_info); | ||
| 743 | cred->cr_group_info = gi; | ||
| 744 | } | ||
| 725 | return SVC_OK; | 745 | return SVC_OK; |
| 726 | } | 746 | } |
| 727 | 747 | ||
| @@ -818,19 +838,11 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp) | |||
| 818 | slen = svc_getnl(argv); /* gids length */ | 838 | slen = svc_getnl(argv); /* gids length */ |
| 819 | if (slen > 16 || (len -= (slen + 2)*4) < 0) | 839 | if (slen > 16 || (len -= (slen + 2)*4) < 0) |
| 820 | goto badcred; | 840 | goto badcred; |
| 821 | if (unix_gid_find(cred->cr_uid, &cred->cr_group_info, rqstp) | 841 | cred->cr_group_info = groups_alloc(slen); |
| 822 | == -EAGAIN) | 842 | if (cred->cr_group_info == NULL) |
| 823 | return SVC_DROP; | 843 | return SVC_DROP; |
| 824 | if (cred->cr_group_info == NULL) { | 844 | for (i = 0; i < slen; i++) |
| 825 | cred->cr_group_info = groups_alloc(slen); | 845 | GROUP_AT(cred->cr_group_info, i) = svc_getnl(argv); |
| 826 | if (cred->cr_group_info == NULL) | ||
| 827 | return SVC_DROP; | ||
| 828 | for (i = 0; i < slen; i++) | ||
| 829 | GROUP_AT(cred->cr_group_info, i) = svc_getnl(argv); | ||
| 830 | } else { | ||
| 831 | for (i = 0; i < slen ; i++) | ||
| 832 | svc_getnl(argv); | ||
| 833 | } | ||
| 834 | if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) { | 846 | if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) { |
| 835 | *authp = rpc_autherr_badverf; | 847 | *authp = rpc_autherr_badverf; |
| 836 | return SVC_DENIED; | 848 | return SVC_DENIED; |
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 1c246a4f491e..a29f259204e6 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
| @@ -272,14 +272,14 @@ static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining) | |||
| 272 | case PF_INET: | 272 | case PF_INET: |
| 273 | len = snprintf(buf, remaining, "ipv4 %s %pI4 %d\n", | 273 | len = snprintf(buf, remaining, "ipv4 %s %pI4 %d\n", |
| 274 | proto_name, | 274 | proto_name, |
| 275 | &inet_sk(sk)->rcv_saddr, | 275 | &inet_sk(sk)->inet_rcv_saddr, |
| 276 | inet_sk(sk)->num); | 276 | inet_sk(sk)->inet_num); |
| 277 | break; | 277 | break; |
| 278 | case PF_INET6: | 278 | case PF_INET6: |
| 279 | len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n", | 279 | len = snprintf(buf, remaining, "ipv6 %s %pI6 %d\n", |
| 280 | proto_name, | 280 | proto_name, |
| 281 | &inet6_sk(sk)->rcv_saddr, | 281 | &inet6_sk(sk)->rcv_saddr, |
| 282 | inet_sk(sk)->num); | 282 | inet_sk(sk)->inet_num); |
| 283 | break; | 283 | break; |
| 284 | default: | 284 | default: |
| 285 | len = snprintf(buf, remaining, "*unknown-%d*\n", | 285 | len = snprintf(buf, remaining, "*unknown-%d*\n", |
| @@ -968,6 +968,7 @@ static int svc_tcp_recv_record(struct svc_sock *svsk, struct svc_rqst *rqstp) | |||
| 968 | return len; | 968 | return len; |
| 969 | err_delete: | 969 | err_delete: |
| 970 | set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); | 970 | set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); |
| 971 | svc_xprt_received(&svsk->sk_xprt); | ||
| 971 | err_again: | 972 | err_again: |
| 972 | return -EAGAIN; | 973 | return -EAGAIN; |
| 973 | } | 974 | } |
| @@ -1311,7 +1312,7 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, | |||
| 1311 | /* Register socket with portmapper */ | 1312 | /* Register socket with portmapper */ |
| 1312 | if (*errp >= 0 && pmap_register) | 1313 | if (*errp >= 0 && pmap_register) |
| 1313 | *errp = svc_register(serv, inet->sk_family, inet->sk_protocol, | 1314 | *errp = svc_register(serv, inet->sk_family, inet->sk_protocol, |
| 1314 | ntohs(inet_sk(inet)->sport)); | 1315 | ntohs(inet_sk(inet)->inet_sport)); |
| 1315 | 1316 | ||
| 1316 | if (*errp < 0) { | 1317 | if (*errp < 0) { |
| 1317 | kfree(svsk); | 1318 | kfree(svsk); |
| @@ -1357,7 +1358,7 @@ int svc_addsock(struct svc_serv *serv, const int fd, char *name_return, | |||
| 1357 | 1358 | ||
| 1358 | if (!so) | 1359 | if (!so) |
| 1359 | return err; | 1360 | return err; |
| 1360 | if (so->sk->sk_family != AF_INET) | 1361 | if ((so->sk->sk_family != PF_INET) && (so->sk->sk_family != PF_INET6)) |
| 1361 | err = -EAFNOSUPPORT; | 1362 | err = -EAFNOSUPPORT; |
| 1362 | else if (so->sk->sk_protocol != IPPROTO_TCP && | 1363 | else if (so->sk->sk_protocol != IPPROTO_TCP && |
| 1363 | so->sk->sk_protocol != IPPROTO_UDP) | 1364 | so->sk->sk_protocol != IPPROTO_UDP) |
diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c index 42f9748ae093..e65dcc613339 100644 --- a/net/sunrpc/sysctl.c +++ b/net/sunrpc/sysctl.c | |||
| @@ -139,46 +139,45 @@ static ctl_table debug_table[] = { | |||
| 139 | .data = &rpc_debug, | 139 | .data = &rpc_debug, |
| 140 | .maxlen = sizeof(int), | 140 | .maxlen = sizeof(int), |
| 141 | .mode = 0644, | 141 | .mode = 0644, |
| 142 | .proc_handler = &proc_dodebug | 142 | .proc_handler = proc_dodebug |
| 143 | }, | 143 | }, |
| 144 | { | 144 | { |
| 145 | .procname = "nfs_debug", | 145 | .procname = "nfs_debug", |
| 146 | .data = &nfs_debug, | 146 | .data = &nfs_debug, |
| 147 | .maxlen = sizeof(int), | 147 | .maxlen = sizeof(int), |
| 148 | .mode = 0644, | 148 | .mode = 0644, |
| 149 | .proc_handler = &proc_dodebug | 149 | .proc_handler = proc_dodebug |
| 150 | }, | 150 | }, |
| 151 | { | 151 | { |
| 152 | .procname = "nfsd_debug", | 152 | .procname = "nfsd_debug", |
| 153 | .data = &nfsd_debug, | 153 | .data = &nfsd_debug, |
| 154 | .maxlen = sizeof(int), | 154 | .maxlen = sizeof(int), |
| 155 | .mode = 0644, | 155 | .mode = 0644, |
| 156 | .proc_handler = &proc_dodebug | 156 | .proc_handler = proc_dodebug |
| 157 | }, | 157 | }, |
| 158 | { | 158 | { |
| 159 | .procname = "nlm_debug", | 159 | .procname = "nlm_debug", |
| 160 | .data = &nlm_debug, | 160 | .data = &nlm_debug, |
| 161 | .maxlen = sizeof(int), | 161 | .maxlen = sizeof(int), |
| 162 | .mode = 0644, | 162 | .mode = 0644, |
| 163 | .proc_handler = &proc_dodebug | 163 | .proc_handler = proc_dodebug |
| 164 | }, | 164 | }, |
| 165 | { | 165 | { |
| 166 | .procname = "transports", | 166 | .procname = "transports", |
| 167 | .maxlen = 256, | 167 | .maxlen = 256, |
| 168 | .mode = 0444, | 168 | .mode = 0444, |
| 169 | .proc_handler = &proc_do_xprt, | 169 | .proc_handler = proc_do_xprt, |
| 170 | }, | 170 | }, |
| 171 | { .ctl_name = 0 } | 171 | { } |
| 172 | }; | 172 | }; |
| 173 | 173 | ||
| 174 | static ctl_table sunrpc_table[] = { | 174 | static ctl_table sunrpc_table[] = { |
| 175 | { | 175 | { |
| 176 | .ctl_name = CTL_SUNRPC, | ||
| 177 | .procname = "sunrpc", | 176 | .procname = "sunrpc", |
| 178 | .mode = 0555, | 177 | .mode = 0555, |
| 179 | .child = debug_table | 178 | .child = debug_table |
| 180 | }, | 179 | }, |
| 181 | { .ctl_name = 0 } | 180 | { } |
| 182 | }; | 181 | }; |
| 183 | 182 | ||
| 184 | #endif | 183 | #endif |
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index 8bd690c48b69..2763fde88499 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
| 10 | #include <linux/slab.h> | ||
| 10 | #include <linux/types.h> | 11 | #include <linux/types.h> |
| 11 | #include <linux/string.h> | 12 | #include <linux/string.h> |
| 12 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index fd46d42afa89..42f09ade0044 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
| @@ -46,6 +46,7 @@ | |||
| 46 | 46 | ||
| 47 | #include <linux/sunrpc/clnt.h> | 47 | #include <linux/sunrpc/clnt.h> |
| 48 | #include <linux/sunrpc/metrics.h> | 48 | #include <linux/sunrpc/metrics.h> |
| 49 | #include <linux/sunrpc/bc_xprt.h> | ||
| 49 | 50 | ||
| 50 | #include "sunrpc.h" | 51 | #include "sunrpc.h" |
| 51 | 52 | ||
| @@ -700,6 +701,10 @@ void xprt_connect(struct rpc_task *task) | |||
| 700 | } | 701 | } |
| 701 | if (!xprt_lock_write(xprt, task)) | 702 | if (!xprt_lock_write(xprt, task)) |
| 702 | return; | 703 | return; |
| 704 | |||
| 705 | if (test_and_clear_bit(XPRT_CLOSE_WAIT, &xprt->state)) | ||
| 706 | xprt->ops->close(xprt); | ||
| 707 | |||
| 703 | if (xprt_connected(xprt)) | 708 | if (xprt_connected(xprt)) |
| 704 | xprt_release_write(xprt, task); | 709 | xprt_release_write(xprt, task); |
| 705 | else { | 710 | else { |
| @@ -1028,21 +1033,16 @@ void xprt_release(struct rpc_task *task) | |||
| 1028 | if (req->rq_release_snd_buf) | 1033 | if (req->rq_release_snd_buf) |
| 1029 | req->rq_release_snd_buf(req); | 1034 | req->rq_release_snd_buf(req); |
| 1030 | 1035 | ||
| 1031 | /* | ||
| 1032 | * Early exit if this is a backchannel preallocated request. | ||
| 1033 | * There is no need to have it added to the RPC slot list. | ||
| 1034 | */ | ||
| 1035 | if (is_bc_request) | ||
| 1036 | return; | ||
| 1037 | |||
| 1038 | memset(req, 0, sizeof(*req)); /* mark unused */ | ||
| 1039 | |||
| 1040 | dprintk("RPC: %5u release request %p\n", task->tk_pid, req); | 1036 | dprintk("RPC: %5u release request %p\n", task->tk_pid, req); |
| 1037 | if (likely(!is_bc_request)) { | ||
| 1038 | memset(req, 0, sizeof(*req)); /* mark unused */ | ||
| 1041 | 1039 | ||
| 1042 | spin_lock(&xprt->reserve_lock); | 1040 | spin_lock(&xprt->reserve_lock); |
| 1043 | list_add(&req->rq_list, &xprt->free); | 1041 | list_add(&req->rq_list, &xprt->free); |
| 1044 | rpc_wake_up_next(&xprt->backlog); | 1042 | rpc_wake_up_next(&xprt->backlog); |
| 1045 | spin_unlock(&xprt->reserve_lock); | 1043 | spin_unlock(&xprt->reserve_lock); |
| 1044 | } else | ||
| 1045 | xprt_free_bc_request(req); | ||
| 1046 | } | 1046 | } |
| 1047 | 1047 | ||
| 1048 | /** | 1048 | /** |
diff --git a/net/sunrpc/xprtrdma/svc_rdma.c b/net/sunrpc/xprtrdma/svc_rdma.c index 35fb68b9c8ec..d718b8fa9525 100644 --- a/net/sunrpc/xprtrdma/svc_rdma.c +++ b/net/sunrpc/xprtrdma/svc_rdma.c | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | */ | 40 | */ |
| 41 | #include <linux/module.h> | 41 | #include <linux/module.h> |
| 42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
| 43 | #include <linux/slab.h> | ||
| 43 | #include <linux/fs.h> | 44 | #include <linux/fs.h> |
| 44 | #include <linux/sysctl.h> | 45 | #include <linux/sysctl.h> |
| 45 | #include <linux/sunrpc/clnt.h> | 46 | #include <linux/sunrpc/clnt.h> |
| @@ -120,8 +121,7 @@ static ctl_table svcrdma_parm_table[] = { | |||
| 120 | .data = &svcrdma_max_requests, | 121 | .data = &svcrdma_max_requests, |
| 121 | .maxlen = sizeof(unsigned int), | 122 | .maxlen = sizeof(unsigned int), |
| 122 | .mode = 0644, | 123 | .mode = 0644, |
| 123 | .proc_handler = &proc_dointvec_minmax, | 124 | .proc_handler = proc_dointvec_minmax, |
| 124 | .strategy = &sysctl_intvec, | ||
| 125 | .extra1 = &min_max_requests, | 125 | .extra1 = &min_max_requests, |
| 126 | .extra2 = &max_max_requests | 126 | .extra2 = &max_max_requests |
| 127 | }, | 127 | }, |
| @@ -130,8 +130,7 @@ static ctl_table svcrdma_parm_table[] = { | |||
| 130 | .data = &svcrdma_max_req_size, | 130 | .data = &svcrdma_max_req_size, |
| 131 | .maxlen = sizeof(unsigned int), | 131 | .maxlen = sizeof(unsigned int), |
| 132 | .mode = 0644, | 132 | .mode = 0644, |
| 133 | .proc_handler = &proc_dointvec_minmax, | 133 | .proc_handler = proc_dointvec_minmax, |
| 134 | .strategy = &sysctl_intvec, | ||
| 135 | .extra1 = &min_max_inline, | 134 | .extra1 = &min_max_inline, |
| 136 | .extra2 = &max_max_inline | 135 | .extra2 = &max_max_inline |
| 137 | }, | 136 | }, |
| @@ -140,8 +139,7 @@ static ctl_table svcrdma_parm_table[] = { | |||
| 140 | .data = &svcrdma_ord, | 139 | .data = &svcrdma_ord, |
| 141 | .maxlen = sizeof(unsigned int), | 140 | .maxlen = sizeof(unsigned int), |
| 142 | .mode = 0644, | 141 | .mode = 0644, |
| 143 | .proc_handler = &proc_dointvec_minmax, | 142 | .proc_handler = proc_dointvec_minmax, |
| 144 | .strategy = &sysctl_intvec, | ||
| 145 | .extra1 = &min_ord, | 143 | .extra1 = &min_ord, |
| 146 | .extra2 = &max_ord, | 144 | .extra2 = &max_ord, |
| 147 | }, | 145 | }, |
| @@ -151,67 +149,65 @@ static ctl_table svcrdma_parm_table[] = { | |||
| 151 | .data = &rdma_stat_read, | 149 | .data = &rdma_stat_read, |
| 152 | .maxlen = sizeof(atomic_t), | 150 | .maxlen = sizeof(atomic_t), |
| 153 | .mode = 0644, | 151 | .mode = 0644, |
| 154 | .proc_handler = &read_reset_stat, | 152 | .proc_handler = read_reset_stat, |
| 155 | }, | 153 | }, |
| 156 | { | 154 | { |
| 157 | .procname = "rdma_stat_recv", | 155 | .procname = "rdma_stat_recv", |
| 158 | .data = &rdma_stat_recv, | 156 | .data = &rdma_stat_recv, |
| 159 | .maxlen = sizeof(atomic_t), | 157 | .maxlen = sizeof(atomic_t), |
| 160 | .mode = 0644, | 158 | .mode = 0644, |
| 161 | .proc_handler = &read_reset_stat, | 159 | .proc_handler = read_reset_stat, |
| 162 | }, | 160 | }, |
| 163 | { | 161 | { |
| 164 | .procname = "rdma_stat_write", | 162 | .procname = "rdma_stat_write", |
| 165 | .data = &rdma_stat_write, | 163 | .data = &rdma_stat_write, |
| 166 | .maxlen = sizeof(atomic_t), | 164 | .maxlen = sizeof(atomic_t), |
| 167 | .mode = 0644, | 165 | .mode = 0644, |
| 168 | .proc_handler = &read_reset_stat, | 166 | .proc_handler = read_reset_stat, |
| 169 | }, | 167 | }, |
| 170 | { | 168 | { |
| 171 | .procname = "rdma_stat_sq_starve", | 169 | .procname = "rdma_stat_sq_starve", |
| 172 | .data = &rdma_stat_sq_starve, | 170 | .data = &rdma_stat_sq_starve, |
| 173 | .maxlen = sizeof(atomic_t), | 171 | .maxlen = sizeof(atomic_t), |
| 174 | .mode = 0644, | 172 | .mode = 0644, |
| 175 | .proc_handler = &read_reset_stat, | 173 | .proc_handler = read_reset_stat, |
| 176 | }, | 174 | }, |
| 177 | { | 175 | { |
| 178 | .procname = "rdma_stat_rq_starve", | 176 | .procname = "rdma_stat_rq_starve", |
| 179 | .data = &rdma_stat_rq_starve, | 177 | .data = &rdma_stat_rq_starve, |
| 180 | .maxlen = sizeof(atomic_t), | 178 | .maxlen = sizeof(atomic_t), |
| 181 | .mode = 0644, | 179 | .mode = 0644, |
| 182 | .proc_handler = &read_reset_stat, | 180 | .proc_handler = read_reset_stat, |
| 183 | }, | 181 | }, |
| 184 | { | 182 | { |
| 185 | .procname = "rdma_stat_rq_poll", | 183 | .procname = "rdma_stat_rq_poll", |
| 186 | .data = &rdma_stat_rq_poll, | 184 | .data = &rdma_stat_rq_poll, |
| 187 | .maxlen = sizeof(atomic_t), | 185 | .maxlen = sizeof(atomic_t), |
| 188 | .mode = 0644, | 186 | .mode = 0644, |
| 189 | .proc_handler = &read_reset_stat, | 187 | .proc_handler = read_reset_stat, |
| 190 | }, | 188 | }, |
| 191 | { | 189 | { |
| 192 | .procname = "rdma_stat_rq_prod", | 190 | .procname = "rdma_stat_rq_prod", |
| 193 | .data = &rdma_stat_rq_prod, | 191 | .data = &rdma_stat_rq_prod, |
| 194 | .maxlen = sizeof(atomic_t), | 192 | .maxlen = sizeof(atomic_t), |
| 195 | .mode = 0644, | 193 | .mode = 0644, |
| 196 | .proc_handler = &read_reset_stat, | 194 | .proc_handler = read_reset_stat, |
| 197 | }, | 195 | }, |
| 198 | { | 196 | { |
| 199 | .procname = "rdma_stat_sq_poll", | 197 | .procname = "rdma_stat_sq_poll", |
| 200 | .data = &rdma_stat_sq_poll, | 198 | .data = &rdma_stat_sq_poll, |
| 201 | .maxlen = sizeof(atomic_t), | 199 | .maxlen = sizeof(atomic_t), |
| 202 | .mode = 0644, | 200 | .mode = 0644, |
| 203 | .proc_handler = &read_reset_stat, | 201 | .proc_handler = read_reset_stat, |
| 204 | }, | 202 | }, |
| 205 | { | 203 | { |
| 206 | .procname = "rdma_stat_sq_prod", | 204 | .procname = "rdma_stat_sq_prod", |
| 207 | .data = &rdma_stat_sq_prod, | 205 | .data = &rdma_stat_sq_prod, |
| 208 | .maxlen = sizeof(atomic_t), | 206 | .maxlen = sizeof(atomic_t), |
| 209 | .mode = 0644, | 207 | .mode = 0644, |
| 210 | .proc_handler = &read_reset_stat, | 208 | .proc_handler = read_reset_stat, |
| 211 | }, | ||
| 212 | { | ||
| 213 | .ctl_name = 0, | ||
| 214 | }, | 209 | }, |
| 210 | { }, | ||
| 215 | }; | 211 | }; |
| 216 | 212 | ||
| 217 | static ctl_table svcrdma_table[] = { | 213 | static ctl_table svcrdma_table[] = { |
| @@ -220,21 +216,16 @@ static ctl_table svcrdma_table[] = { | |||
| 220 | .mode = 0555, | 216 | .mode = 0555, |
| 221 | .child = svcrdma_parm_table | 217 | .child = svcrdma_parm_table |
| 222 | }, | 218 | }, |
| 223 | { | 219 | { }, |
| 224 | .ctl_name = 0, | ||
| 225 | }, | ||
| 226 | }; | 220 | }; |
| 227 | 221 | ||
| 228 | static ctl_table svcrdma_root_table[] = { | 222 | static ctl_table svcrdma_root_table[] = { |
| 229 | { | 223 | { |
| 230 | .ctl_name = CTL_SUNRPC, | ||
| 231 | .procname = "sunrpc", | 224 | .procname = "sunrpc", |
| 232 | .mode = 0555, | 225 | .mode = 0555, |
| 233 | .child = svcrdma_table | 226 | .child = svcrdma_table |
| 234 | }, | 227 | }, |
| 235 | { | 228 | { }, |
| 236 | .ctl_name = 0, | ||
| 237 | }, | ||
| 238 | }; | 229 | }; |
| 239 | 230 | ||
| 240 | void svc_rdma_cleanup(void) | 231 | void svc_rdma_cleanup(void) |
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index 9e884383134f..f92e37eb413c 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | |||
| @@ -337,10 +337,9 @@ static int rdma_set_ctxt_sge(struct svcxprt_rdma *xprt, | |||
| 337 | 337 | ||
| 338 | static int rdma_read_max_sge(struct svcxprt_rdma *xprt, int sge_count) | 338 | static int rdma_read_max_sge(struct svcxprt_rdma *xprt, int sge_count) |
| 339 | { | 339 | { |
| 340 | if ((RDMA_TRANSPORT_IWARP == | 340 | if ((rdma_node_get_transport(xprt->sc_cm_id->device->node_type) == |
| 341 | rdma_node_get_transport(xprt->sc_cm_id-> | 341 | RDMA_TRANSPORT_IWARP) && |
| 342 | device->node_type)) | 342 | sge_count > 1) |
| 343 | && sge_count > 1) | ||
| 344 | return 1; | 343 | return 1; |
| 345 | else | 344 | else |
| 346 | return min_t(int, sge_count, xprt->sc_max_sge); | 345 | return min_t(int, sge_count, xprt->sc_max_sge); |
diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c index f11be72a1a80..b15e1ebb2bfa 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c | |||
| @@ -54,7 +54,7 @@ | |||
| 54 | * Assumptions: | 54 | * Assumptions: |
| 55 | * - head[0] is physically contiguous. | 55 | * - head[0] is physically contiguous. |
| 56 | * - tail[0] is physically contiguous. | 56 | * - tail[0] is physically contiguous. |
| 57 | * - pages[] is not physically or virtually contigous and consists of | 57 | * - pages[] is not physically or virtually contiguous and consists of |
| 58 | * PAGE_SIZE elements. | 58 | * PAGE_SIZE elements. |
| 59 | * | 59 | * |
| 60 | * Output: | 60 | * Output: |
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c index 3fa5751af0ec..edea15a54e51 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | #include <linux/sunrpc/debug.h> | 43 | #include <linux/sunrpc/debug.h> |
| 44 | #include <linux/sunrpc/rpc_rdma.h> | 44 | #include <linux/sunrpc/rpc_rdma.h> |
| 45 | #include <linux/sched.h> | 45 | #include <linux/sched.h> |
| 46 | #include <linux/slab.h> | ||
| 46 | #include <linux/spinlock.h> | 47 | #include <linux/spinlock.h> |
| 47 | #include <rdma/ib_verbs.h> | 48 | #include <rdma/ib_verbs.h> |
| 48 | #include <rdma/rdma_cm.h> | 49 | #include <rdma/rdma_cm.h> |
| @@ -678,7 +679,10 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv, | |||
| 678 | int ret; | 679 | int ret; |
| 679 | 680 | ||
| 680 | dprintk("svcrdma: Creating RDMA socket\n"); | 681 | dprintk("svcrdma: Creating RDMA socket\n"); |
| 681 | 682 | if (sa->sa_family != AF_INET) { | |
| 683 | dprintk("svcrdma: Address family %d is not supported.\n", sa->sa_family); | ||
| 684 | return ERR_PTR(-EAFNOSUPPORT); | ||
| 685 | } | ||
| 682 | cma_xprt = rdma_create_xprt(serv, 1); | 686 | cma_xprt = rdma_create_xprt(serv, 1); |
| 683 | if (!cma_xprt) | 687 | if (!cma_xprt) |
| 684 | return ERR_PTR(-ENOMEM); | 688 | return ERR_PTR(-ENOMEM); |
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index 9a63f669ece4..187257b1d880 100644 --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c | |||
| @@ -49,6 +49,7 @@ | |||
| 49 | 49 | ||
| 50 | #include <linux/module.h> | 50 | #include <linux/module.h> |
| 51 | #include <linux/init.h> | 51 | #include <linux/init.h> |
| 52 | #include <linux/slab.h> | ||
| 52 | #include <linux/seq_file.h> | 53 | #include <linux/seq_file.h> |
| 53 | 54 | ||
| 54 | #include "xprt_rdma.h" | 55 | #include "xprt_rdma.h" |
| @@ -86,79 +87,63 @@ static struct ctl_table_header *sunrpc_table_header; | |||
| 86 | 87 | ||
| 87 | static ctl_table xr_tunables_table[] = { | 88 | static ctl_table xr_tunables_table[] = { |
| 88 | { | 89 | { |
| 89 | .ctl_name = CTL_UNNUMBERED, | ||
| 90 | .procname = "rdma_slot_table_entries", | 90 | .procname = "rdma_slot_table_entries", |
| 91 | .data = &xprt_rdma_slot_table_entries, | 91 | .data = &xprt_rdma_slot_table_entries, |
| 92 | .maxlen = sizeof(unsigned int), | 92 | .maxlen = sizeof(unsigned int), |
| 93 | .mode = 0644, | 93 | .mode = 0644, |
| 94 | .proc_handler = &proc_dointvec_minmax, | 94 | .proc_handler = proc_dointvec_minmax, |
| 95 | .strategy = &sysctl_intvec, | ||
| 96 | .extra1 = &min_slot_table_size, | 95 | .extra1 = &min_slot_table_size, |
| 97 | .extra2 = &max_slot_table_size | 96 | .extra2 = &max_slot_table_size |
| 98 | }, | 97 | }, |
| 99 | { | 98 | { |
| 100 | .ctl_name = CTL_UNNUMBERED, | ||
| 101 | .procname = "rdma_max_inline_read", | 99 | .procname = "rdma_max_inline_read", |
| 102 | .data = &xprt_rdma_max_inline_read, | 100 | .data = &xprt_rdma_max_inline_read, |
| 103 | .maxlen = sizeof(unsigned int), | 101 | .maxlen = sizeof(unsigned int), |
| 104 | .mode = 0644, | 102 | .mode = 0644, |
| 105 | .proc_handler = &proc_dointvec, | 103 | .proc_handler = proc_dointvec, |
| 106 | .strategy = &sysctl_intvec, | ||
| 107 | }, | 104 | }, |
| 108 | { | 105 | { |
| 109 | .ctl_name = CTL_UNNUMBERED, | ||
| 110 | .procname = "rdma_max_inline_write", | 106 | .procname = "rdma_max_inline_write", |
| 111 | .data = &xprt_rdma_max_inline_write, | 107 | .data = &xprt_rdma_max_inline_write, |
| 112 | .maxlen = sizeof(unsigned int), | 108 | .maxlen = sizeof(unsigned int), |
| 113 | .mode = 0644, | 109 | .mode = 0644, |
| 114 | .proc_handler = &proc_dointvec, | 110 | .proc_handler = proc_dointvec, |
| 115 | .strategy = &sysctl_intvec, | ||
| 116 | }, | 111 | }, |
| 117 | { | 112 | { |
| 118 | .ctl_name = CTL_UNNUMBERED, | ||
| 119 | .procname = "rdma_inline_write_padding", | 113 | .procname = "rdma_inline_write_padding", |
| 120 | .data = &xprt_rdma_inline_write_padding, | 114 | .data = &xprt_rdma_inline_write_padding, |
| 121 | .maxlen = sizeof(unsigned int), | 115 | .maxlen = sizeof(unsigned int), |
| 122 | .mode = 0644, | 116 | .mode = 0644, |
| 123 | .proc_handler = &proc_dointvec_minmax, | 117 | .proc_handler = proc_dointvec_minmax, |
| 124 | .strategy = &sysctl_intvec, | ||
| 125 | .extra1 = &zero, | 118 | .extra1 = &zero, |
| 126 | .extra2 = &max_padding, | 119 | .extra2 = &max_padding, |
| 127 | }, | 120 | }, |
| 128 | { | 121 | { |
| 129 | .ctl_name = CTL_UNNUMBERED, | ||
| 130 | .procname = "rdma_memreg_strategy", | 122 | .procname = "rdma_memreg_strategy", |
| 131 | .data = &xprt_rdma_memreg_strategy, | 123 | .data = &xprt_rdma_memreg_strategy, |
| 132 | .maxlen = sizeof(unsigned int), | 124 | .maxlen = sizeof(unsigned int), |
| 133 | .mode = 0644, | 125 | .mode = 0644, |
| 134 | .proc_handler = &proc_dointvec_minmax, | 126 | .proc_handler = proc_dointvec_minmax, |
| 135 | .strategy = &sysctl_intvec, | ||
| 136 | .extra1 = &min_memreg, | 127 | .extra1 = &min_memreg, |
| 137 | .extra2 = &max_memreg, | 128 | .extra2 = &max_memreg, |
| 138 | }, | 129 | }, |
| 139 | { | 130 | { |
| 140 | .ctl_name = CTL_UNNUMBERED, | ||
| 141 | .procname = "rdma_pad_optimize", | 131 | .procname = "rdma_pad_optimize", |
| 142 | .data = &xprt_rdma_pad_optimize, | 132 | .data = &xprt_rdma_pad_optimize, |
| 143 | .maxlen = sizeof(unsigned int), | 133 | .maxlen = sizeof(unsigned int), |
| 144 | .mode = 0644, | 134 | .mode = 0644, |
| 145 | .proc_handler = &proc_dointvec, | 135 | .proc_handler = proc_dointvec, |
| 146 | }, | ||
| 147 | { | ||
| 148 | .ctl_name = 0, | ||
| 149 | }, | 136 | }, |
| 137 | { }, | ||
| 150 | }; | 138 | }; |
| 151 | 139 | ||
| 152 | static ctl_table sunrpc_table[] = { | 140 | static ctl_table sunrpc_table[] = { |
| 153 | { | 141 | { |
| 154 | .ctl_name = CTL_SUNRPC, | ||
| 155 | .procname = "sunrpc", | 142 | .procname = "sunrpc", |
| 156 | .mode = 0555, | 143 | .mode = 0555, |
| 157 | .child = xr_tunables_table | 144 | .child = xr_tunables_table |
| 158 | }, | 145 | }, |
| 159 | { | 146 | { }, |
| 160 | .ctl_name = 0, | ||
| 161 | }, | ||
| 162 | }; | 147 | }; |
| 163 | 148 | ||
| 164 | #endif | 149 | #endif |
| @@ -176,16 +161,15 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt) | |||
| 176 | (void)rpc_ntop(sap, buf, sizeof(buf)); | 161 | (void)rpc_ntop(sap, buf, sizeof(buf)); |
| 177 | xprt->address_strings[RPC_DISPLAY_ADDR] = kstrdup(buf, GFP_KERNEL); | 162 | xprt->address_strings[RPC_DISPLAY_ADDR] = kstrdup(buf, GFP_KERNEL); |
| 178 | 163 | ||
| 179 | (void)snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap)); | 164 | snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap)); |
| 180 | xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL); | 165 | xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL); |
| 181 | 166 | ||
| 182 | xprt->address_strings[RPC_DISPLAY_PROTO] = "rdma"; | 167 | xprt->address_strings[RPC_DISPLAY_PROTO] = "rdma"; |
| 183 | 168 | ||
| 184 | (void)snprintf(buf, sizeof(buf), "%02x%02x%02x%02x", | 169 | snprintf(buf, sizeof(buf), "%08x", ntohl(sin->sin_addr.s_addr)); |
| 185 | NIPQUAD(sin->sin_addr.s_addr)); | ||
| 186 | xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = kstrdup(buf, GFP_KERNEL); | 170 | xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = kstrdup(buf, GFP_KERNEL); |
| 187 | 171 | ||
| 188 | (void)snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap)); | 172 | snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap)); |
| 189 | xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL); | 173 | xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL); |
| 190 | 174 | ||
| 191 | /* netid */ | 175 | /* netid */ |
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 465aafc2007f..27015c6d8eb5 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c | |||
| @@ -48,6 +48,7 @@ | |||
| 48 | */ | 48 | */ |
| 49 | 49 | ||
| 50 | #include <linux/pci.h> /* for Tavor hack below */ | 50 | #include <linux/pci.h> /* for Tavor hack below */ |
| 51 | #include <linux/slab.h> | ||
| 51 | 52 | ||
| 52 | #include "xprt_rdma.h" | 53 | #include "xprt_rdma.h" |
| 53 | 54 | ||
| @@ -878,8 +879,8 @@ if (strnicmp(ia->ri_id->device->dma_device->bus->name, "pci", 3) == 0) { | |||
| 878 | * others indicate a transport condition which has already | 879 | * others indicate a transport condition which has already |
| 879 | * undergone a best-effort. | 880 | * undergone a best-effort. |
| 880 | */ | 881 | */ |
| 881 | if (ep->rep_connected == -ECONNREFUSED | 882 | if (ep->rep_connected == -ECONNREFUSED && |
| 882 | && ++retry_count <= RDMA_CONNECT_RETRY_MAX) { | 883 | ++retry_count <= RDMA_CONNECT_RETRY_MAX) { |
| 883 | dprintk("RPC: %s: non-peer_reject, retry\n", __func__); | 884 | dprintk("RPC: %s: non-peer_reject, retry\n", __func__); |
| 884 | goto retry; | 885 | goto retry; |
| 885 | } | 886 | } |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 37c5475ba258..9847c30b5001 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
| @@ -81,46 +81,38 @@ static struct ctl_table_header *sunrpc_table_header; | |||
| 81 | */ | 81 | */ |
| 82 | static ctl_table xs_tunables_table[] = { | 82 | static ctl_table xs_tunables_table[] = { |
| 83 | { | 83 | { |
| 84 | .ctl_name = CTL_SLOTTABLE_UDP, | ||
| 85 | .procname = "udp_slot_table_entries", | 84 | .procname = "udp_slot_table_entries", |
| 86 | .data = &xprt_udp_slot_table_entries, | 85 | .data = &xprt_udp_slot_table_entries, |
| 87 | .maxlen = sizeof(unsigned int), | 86 | .maxlen = sizeof(unsigned int), |
| 88 | .mode = 0644, | 87 | .mode = 0644, |
| 89 | .proc_handler = &proc_dointvec_minmax, | 88 | .proc_handler = proc_dointvec_minmax, |
| 90 | .strategy = &sysctl_intvec, | ||
| 91 | .extra1 = &min_slot_table_size, | 89 | .extra1 = &min_slot_table_size, |
| 92 | .extra2 = &max_slot_table_size | 90 | .extra2 = &max_slot_table_size |
| 93 | }, | 91 | }, |
| 94 | { | 92 | { |
| 95 | .ctl_name = CTL_SLOTTABLE_TCP, | ||
| 96 | .procname = "tcp_slot_table_entries", | 93 | .procname = "tcp_slot_table_entries", |
| 97 | .data = &xprt_tcp_slot_table_entries, | 94 | .data = &xprt_tcp_slot_table_entries, |
| 98 | .maxlen = sizeof(unsigned int), | 95 | .maxlen = sizeof(unsigned int), |
| 99 | .mode = 0644, | 96 | .mode = 0644, |
| 100 | .proc_handler = &proc_dointvec_minmax, | 97 | .proc_handler = proc_dointvec_minmax, |
| 101 | .strategy = &sysctl_intvec, | ||
| 102 | .extra1 = &min_slot_table_size, | 98 | .extra1 = &min_slot_table_size, |
| 103 | .extra2 = &max_slot_table_size | 99 | .extra2 = &max_slot_table_size |
| 104 | }, | 100 | }, |
| 105 | { | 101 | { |
| 106 | .ctl_name = CTL_MIN_RESVPORT, | ||
| 107 | .procname = "min_resvport", | 102 | .procname = "min_resvport", |
| 108 | .data = &xprt_min_resvport, | 103 | .data = &xprt_min_resvport, |
| 109 | .maxlen = sizeof(unsigned int), | 104 | .maxlen = sizeof(unsigned int), |
| 110 | .mode = 0644, | 105 | .mode = 0644, |
| 111 | .proc_handler = &proc_dointvec_minmax, | 106 | .proc_handler = proc_dointvec_minmax, |
| 112 | .strategy = &sysctl_intvec, | ||
| 113 | .extra1 = &xprt_min_resvport_limit, | 107 | .extra1 = &xprt_min_resvport_limit, |
| 114 | .extra2 = &xprt_max_resvport_limit | 108 | .extra2 = &xprt_max_resvport_limit |
| 115 | }, | 109 | }, |
| 116 | { | 110 | { |
| 117 | .ctl_name = CTL_MAX_RESVPORT, | ||
| 118 | .procname = "max_resvport", | 111 | .procname = "max_resvport", |
| 119 | .data = &xprt_max_resvport, | 112 | .data = &xprt_max_resvport, |
| 120 | .maxlen = sizeof(unsigned int), | 113 | .maxlen = sizeof(unsigned int), |
| 121 | .mode = 0644, | 114 | .mode = 0644, |
| 122 | .proc_handler = &proc_dointvec_minmax, | 115 | .proc_handler = proc_dointvec_minmax, |
| 123 | .strategy = &sysctl_intvec, | ||
| 124 | .extra1 = &xprt_min_resvport_limit, | 116 | .extra1 = &xprt_min_resvport_limit, |
| 125 | .extra2 = &xprt_max_resvport_limit | 117 | .extra2 = &xprt_max_resvport_limit |
| 126 | }, | 118 | }, |
| @@ -129,24 +121,18 @@ static ctl_table xs_tunables_table[] = { | |||
| 129 | .data = &xs_tcp_fin_timeout, | 121 | .data = &xs_tcp_fin_timeout, |
| 130 | .maxlen = sizeof(xs_tcp_fin_timeout), | 122 | .maxlen = sizeof(xs_tcp_fin_timeout), |
| 131 | .mode = 0644, | 123 | .mode = 0644, |
| 132 | .proc_handler = &proc_dointvec_jiffies, | 124 | .proc_handler = proc_dointvec_jiffies, |
| 133 | .strategy = sysctl_jiffies | ||
| 134 | }, | ||
| 135 | { | ||
| 136 | .ctl_name = 0, | ||
| 137 | }, | 125 | }, |
| 126 | { }, | ||
| 138 | }; | 127 | }; |
| 139 | 128 | ||
| 140 | static ctl_table sunrpc_table[] = { | 129 | static ctl_table sunrpc_table[] = { |
| 141 | { | 130 | { |
| 142 | .ctl_name = CTL_SUNRPC, | ||
| 143 | .procname = "sunrpc", | 131 | .procname = "sunrpc", |
| 144 | .mode = 0555, | 132 | .mode = 0555, |
| 145 | .child = xs_tunables_table | 133 | .child = xs_tunables_table |
| 146 | }, | 134 | }, |
| 147 | { | 135 | { }, |
| 148 | .ctl_name = 0, | ||
| 149 | }, | ||
| 150 | }; | 136 | }; |
| 151 | 137 | ||
| 152 | #endif | 138 | #endif |
| @@ -311,12 +297,11 @@ static void xs_format_common_peer_addresses(struct rpc_xprt *xprt) | |||
| 311 | switch (sap->sa_family) { | 297 | switch (sap->sa_family) { |
| 312 | case AF_INET: | 298 | case AF_INET: |
| 313 | sin = xs_addr_in(xprt); | 299 | sin = xs_addr_in(xprt); |
| 314 | (void)snprintf(buf, sizeof(buf), "%02x%02x%02x%02x", | 300 | snprintf(buf, sizeof(buf), "%08x", ntohl(sin->sin_addr.s_addr)); |
| 315 | NIPQUAD(sin->sin_addr.s_addr)); | ||
| 316 | break; | 301 | break; |
| 317 | case AF_INET6: | 302 | case AF_INET6: |
| 318 | sin6 = xs_addr_in6(xprt); | 303 | sin6 = xs_addr_in6(xprt); |
| 319 | (void)snprintf(buf, sizeof(buf), "%pi6", &sin6->sin6_addr); | 304 | snprintf(buf, sizeof(buf), "%pi6", &sin6->sin6_addr); |
| 320 | break; | 305 | break; |
| 321 | default: | 306 | default: |
| 322 | BUG(); | 307 | BUG(); |
| @@ -329,10 +314,10 @@ static void xs_format_common_peer_ports(struct rpc_xprt *xprt) | |||
| 329 | struct sockaddr *sap = xs_addr(xprt); | 314 | struct sockaddr *sap = xs_addr(xprt); |
| 330 | char buf[128]; | 315 | char buf[128]; |
| 331 | 316 | ||
| 332 | (void)snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap)); | 317 | snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap)); |
| 333 | xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL); | 318 | xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL); |
| 334 | 319 | ||
| 335 | (void)snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap)); | 320 | snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap)); |
| 336 | xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL); | 321 | xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL); |
| 337 | } | 322 | } |
| 338 | 323 | ||
| @@ -563,8 +548,6 @@ static int xs_udp_send_request(struct rpc_task *task) | |||
| 563 | /* Still some bytes left; set up for a retry later. */ | 548 | /* Still some bytes left; set up for a retry later. */ |
| 564 | status = -EAGAIN; | 549 | status = -EAGAIN; |
| 565 | } | 550 | } |
| 566 | if (!transport->sock) | ||
| 567 | goto out; | ||
| 568 | 551 | ||
| 569 | switch (status) { | 552 | switch (status) { |
| 570 | case -ENOTSOCK: | 553 | case -ENOTSOCK: |
| @@ -584,7 +567,7 @@ static int xs_udp_send_request(struct rpc_task *task) | |||
| 584 | * prompts ECONNREFUSED. */ | 567 | * prompts ECONNREFUSED. */ |
| 585 | clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); | 568 | clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); |
| 586 | } | 569 | } |
| 587 | out: | 570 | |
| 588 | return status; | 571 | return status; |
| 589 | } | 572 | } |
| 590 | 573 | ||
| @@ -666,8 +649,6 @@ static int xs_tcp_send_request(struct rpc_task *task) | |||
| 666 | status = -EAGAIN; | 649 | status = -EAGAIN; |
| 667 | break; | 650 | break; |
| 668 | } | 651 | } |
| 669 | if (!transport->sock) | ||
| 670 | goto out; | ||
| 671 | 652 | ||
| 672 | switch (status) { | 653 | switch (status) { |
| 673 | case -ENOTSOCK: | 654 | case -ENOTSOCK: |
| @@ -687,7 +668,7 @@ static int xs_tcp_send_request(struct rpc_task *task) | |||
| 687 | case -ENOTCONN: | 668 | case -ENOTCONN: |
| 688 | clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); | 669 | clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); |
| 689 | } | 670 | } |
| 690 | out: | 671 | |
| 691 | return status; | 672 | return status; |
| 692 | } | 673 | } |
| 693 | 674 | ||
| @@ -1926,6 +1907,11 @@ static void xs_tcp_setup_socket(struct rpc_xprt *xprt, | |||
| 1926 | case -EALREADY: | 1907 | case -EALREADY: |
| 1927 | xprt_clear_connecting(xprt); | 1908 | xprt_clear_connecting(xprt); |
| 1928 | return; | 1909 | return; |
| 1910 | case -EINVAL: | ||
| 1911 | /* Happens, for instance, if the user specified a link | ||
| 1912 | * local IPv6 address without a scope-id. | ||
| 1913 | */ | ||
| 1914 | goto out; | ||
| 1929 | } | 1915 | } |
| 1930 | out_eagain: | 1916 | out_eagain: |
| 1931 | status = -EAGAIN; | 1917 | status = -EAGAIN; |
| @@ -2033,7 +2019,7 @@ static void xs_connect(struct rpc_task *task) | |||
| 2033 | if (xprt_test_and_set_connecting(xprt)) | 2019 | if (xprt_test_and_set_connecting(xprt)) |
| 2034 | return; | 2020 | return; |
| 2035 | 2021 | ||
| 2036 | if (transport->sock != NULL) { | 2022 | if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) { |
| 2037 | dprintk("RPC: xs_connect delayed xprt %p for %lu " | 2023 | dprintk("RPC: xs_connect delayed xprt %p for %lu " |
| 2038 | "seconds\n", | 2024 | "seconds\n", |
| 2039 | xprt, xprt->reestablish_timeout / HZ); | 2025 | xprt, xprt->reestablish_timeout / HZ); |
| @@ -2114,7 +2100,7 @@ static void xs_tcp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) | |||
| 2114 | * we allocate pages instead doing a kmalloc like rpc_malloc is because we want | 2100 | * we allocate pages instead doing a kmalloc like rpc_malloc is because we want |
| 2115 | * to use the server side send routines. | 2101 | * to use the server side send routines. |
| 2116 | */ | 2102 | */ |
| 2117 | void *bc_malloc(struct rpc_task *task, size_t size) | 2103 | static void *bc_malloc(struct rpc_task *task, size_t size) |
| 2118 | { | 2104 | { |
| 2119 | struct page *page; | 2105 | struct page *page; |
| 2120 | struct rpc_buffer *buf; | 2106 | struct rpc_buffer *buf; |
| @@ -2134,7 +2120,7 @@ void *bc_malloc(struct rpc_task *task, size_t size) | |||
| 2134 | /* | 2120 | /* |
| 2135 | * Free the space allocated in the bc_alloc routine | 2121 | * Free the space allocated in the bc_alloc routine |
| 2136 | */ | 2122 | */ |
| 2137 | void bc_free(void *buffer) | 2123 | static void bc_free(void *buffer) |
| 2138 | { | 2124 | { |
| 2139 | struct rpc_buffer *buf; | 2125 | struct rpc_buffer *buf; |
| 2140 | 2126 | ||
| @@ -2265,9 +2251,6 @@ static struct rpc_xprt_ops xs_tcp_ops = { | |||
| 2265 | .buf_free = rpc_free, | 2251 | .buf_free = rpc_free, |
| 2266 | .send_request = xs_tcp_send_request, | 2252 | .send_request = xs_tcp_send_request, |
| 2267 | .set_retrans_timeout = xprt_set_retrans_timeout_def, | 2253 | .set_retrans_timeout = xprt_set_retrans_timeout_def, |
| 2268 | #if defined(CONFIG_NFS_V4_1) | ||
| 2269 | .release_request = bc_release_request, | ||
| 2270 | #endif /* CONFIG_NFS_V4_1 */ | ||
| 2271 | .close = xs_tcp_close, | 2254 | .close = xs_tcp_close, |
| 2272 | .destroy = xs_destroy, | 2255 | .destroy = xs_destroy, |
| 2273 | .print_stats = xs_tcp_print_stats, | 2256 | .print_stats = xs_tcp_print_stats, |
