diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-07-15 18:34:16 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-07-15 18:34:16 -0400 |
commit | e89e896d31b11a51a54ddcd3f72a76bd286dd86c (patch) | |
tree | 105a9a93a4021caeeba76e479778ad2dd2b87b57 /net | |
parent | 3a628b0fd42f7eaf9d052447784d48ceae9ffb8e (diff) | |
parent | d67d1c7bf948341fd8678c8e337ec27f4b46b206 (diff) |
Merge branch 'devel' into next
Conflicts:
fs/nfs/file.c
Fix up the conflict with Jon Corbet's bkl-removal tree
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 27 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_krb5_mech.c | 4 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_spkm3_mech.c | 4 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_spkm3_token.c | 2 | ||||
-rw-r--r-- | net/sunrpc/auth_unix.c | 2 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 161 | ||||
-rw-r--r-- | net/sunrpc/rpcb_clnt.c | 356 | ||||
-rw-r--r-- | net/sunrpc/sched.c | 14 | ||||
-rw-r--r-- | net/sunrpc/xprt.c | 9 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 2 |
10 files changed, 399 insertions, 182 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index cc12d5f5d5da..834a83199bdf 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -63,22 +63,11 @@ static const struct rpc_credops gss_nullops; | |||
63 | # define RPCDBG_FACILITY RPCDBG_AUTH | 63 | # define RPCDBG_FACILITY RPCDBG_AUTH |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | #define NFS_NGROUPS 16 | 66 | #define GSS_CRED_SLACK 1024 |
67 | |||
68 | #define GSS_CRED_SLACK 1024 /* XXX: unused */ | ||
69 | /* length of a krb5 verifier (48), plus data added before arguments when | 67 | /* length of a krb5 verifier (48), plus data added before arguments when |
70 | * using integrity (two 4-byte integers): */ | 68 | * using integrity (two 4-byte integers): */ |
71 | #define GSS_VERF_SLACK 100 | 69 | #define GSS_VERF_SLACK 100 |
72 | 70 | ||
73 | /* XXX this define must match the gssd define | ||
74 | * as it is passed to gssd to signal the use of | ||
75 | * machine creds should be part of the shared rpc interface */ | ||
76 | |||
77 | #define CA_RUN_AS_MACHINE 0x00000200 | ||
78 | |||
79 | /* dump the buffer in `emacs-hexl' style */ | ||
80 | #define isprint(c) ((c > 0x1f) && (c < 0x7f)) | ||
81 | |||
82 | struct gss_auth { | 71 | struct gss_auth { |
83 | struct kref kref; | 72 | struct kref kref; |
84 | struct rpc_auth rpc_auth; | 73 | struct rpc_auth rpc_auth; |
@@ -146,7 +135,7 @@ simple_get_netobj(const void *p, const void *end, struct xdr_netobj *dest) | |||
146 | q = (const void *)((const char *)p + len); | 135 | q = (const void *)((const char *)p + len); |
147 | if (unlikely(q > end || q < p)) | 136 | if (unlikely(q > end || q < p)) |
148 | return ERR_PTR(-EFAULT); | 137 | return ERR_PTR(-EFAULT); |
149 | dest->data = kmemdup(p, len, GFP_KERNEL); | 138 | dest->data = kmemdup(p, len, GFP_NOFS); |
150 | if (unlikely(dest->data == NULL)) | 139 | if (unlikely(dest->data == NULL)) |
151 | return ERR_PTR(-ENOMEM); | 140 | return ERR_PTR(-ENOMEM); |
152 | dest->len = len; | 141 | dest->len = len; |
@@ -171,7 +160,7 @@ gss_alloc_context(void) | |||
171 | { | 160 | { |
172 | struct gss_cl_ctx *ctx; | 161 | struct gss_cl_ctx *ctx; |
173 | 162 | ||
174 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); | 163 | ctx = kzalloc(sizeof(*ctx), GFP_NOFS); |
175 | if (ctx != NULL) { | 164 | if (ctx != NULL) { |
176 | ctx->gc_proc = RPC_GSS_PROC_DATA; | 165 | ctx->gc_proc = RPC_GSS_PROC_DATA; |
177 | ctx->gc_seq = 1; /* NetApp 6.4R1 doesn't accept seq. no. 0 */ | 166 | ctx->gc_seq = 1; /* NetApp 6.4R1 doesn't accept seq. no. 0 */ |
@@ -272,7 +261,7 @@ __gss_find_upcall(struct rpc_inode *rpci, uid_t uid) | |||
272 | return NULL; | 261 | return NULL; |
273 | } | 262 | } |
274 | 263 | ||
275 | /* Try to add a upcall to the pipefs queue. | 264 | /* Try to add an upcall to the pipefs queue. |
276 | * If an upcall owned by our uid already exists, then we return a reference | 265 | * If an upcall owned by our uid already exists, then we return a reference |
277 | * to that upcall instead of adding the new upcall. | 266 | * to that upcall instead of adding the new upcall. |
278 | */ | 267 | */ |
@@ -341,7 +330,7 @@ gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid) | |||
341 | { | 330 | { |
342 | struct gss_upcall_msg *gss_msg; | 331 | struct gss_upcall_msg *gss_msg; |
343 | 332 | ||
344 | gss_msg = kzalloc(sizeof(*gss_msg), GFP_KERNEL); | 333 | gss_msg = kzalloc(sizeof(*gss_msg), GFP_NOFS); |
345 | if (gss_msg != NULL) { | 334 | if (gss_msg != NULL) { |
346 | INIT_LIST_HEAD(&gss_msg->list); | 335 | INIT_LIST_HEAD(&gss_msg->list); |
347 | rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq"); | 336 | rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq"); |
@@ -493,7 +482,6 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | |||
493 | { | 482 | { |
494 | const void *p, *end; | 483 | const void *p, *end; |
495 | void *buf; | 484 | void *buf; |
496 | struct rpc_clnt *clnt; | ||
497 | struct gss_upcall_msg *gss_msg; | 485 | struct gss_upcall_msg *gss_msg; |
498 | struct inode *inode = filp->f_path.dentry->d_inode; | 486 | struct inode *inode = filp->f_path.dentry->d_inode; |
499 | struct gss_cl_ctx *ctx; | 487 | struct gss_cl_ctx *ctx; |
@@ -503,11 +491,10 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | |||
503 | if (mlen > MSG_BUF_MAXSIZE) | 491 | if (mlen > MSG_BUF_MAXSIZE) |
504 | goto out; | 492 | goto out; |
505 | err = -ENOMEM; | 493 | err = -ENOMEM; |
506 | buf = kmalloc(mlen, GFP_KERNEL); | 494 | buf = kmalloc(mlen, GFP_NOFS); |
507 | if (!buf) | 495 | if (!buf) |
508 | goto out; | 496 | goto out; |
509 | 497 | ||
510 | clnt = RPC_I(inode)->private; | ||
511 | err = -EFAULT; | 498 | err = -EFAULT; |
512 | if (copy_from_user(buf, src, mlen)) | 499 | if (copy_from_user(buf, src, mlen)) |
513 | goto err; | 500 | goto err; |
@@ -806,7 +793,7 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags) | |||
806 | dprintk("RPC: gss_create_cred for uid %d, flavor %d\n", | 793 | dprintk("RPC: gss_create_cred for uid %d, flavor %d\n", |
807 | acred->uid, auth->au_flavor); | 794 | acred->uid, auth->au_flavor); |
808 | 795 | ||
809 | if (!(cred = kzalloc(sizeof(*cred), GFP_KERNEL))) | 796 | if (!(cred = kzalloc(sizeof(*cred), GFP_NOFS))) |
810 | goto out_err; | 797 | goto out_err; |
811 | 798 | ||
812 | rpcauth_init_cred(&cred->gc_base, acred, auth, &gss_credops); | 799 | rpcauth_init_cred(&cred->gc_base, acred, auth, &gss_credops); |
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c index 60c3dba545d7..ef45eba22485 100644 --- a/net/sunrpc/auth_gss/gss_krb5_mech.c +++ b/net/sunrpc/auth_gss/gss_krb5_mech.c | |||
@@ -70,7 +70,7 @@ simple_get_netobj(const void *p, const void *end, struct xdr_netobj *res) | |||
70 | q = (const void *)((const char *)p + len); | 70 | q = (const void *)((const char *)p + len); |
71 | if (unlikely(q > end || q < p)) | 71 | if (unlikely(q > end || q < p)) |
72 | return ERR_PTR(-EFAULT); | 72 | return ERR_PTR(-EFAULT); |
73 | res->data = kmemdup(p, len, GFP_KERNEL); | 73 | res->data = kmemdup(p, len, GFP_NOFS); |
74 | if (unlikely(res->data == NULL)) | 74 | if (unlikely(res->data == NULL)) |
75 | return ERR_PTR(-ENOMEM); | 75 | return ERR_PTR(-ENOMEM); |
76 | res->len = len; | 76 | res->len = len; |
@@ -131,7 +131,7 @@ 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_KERNEL))) | 134 | if (!(ctx = kzalloc(sizeof(*ctx), GFP_NOFS))) |
135 | goto out_err; | 135 | goto out_err; |
136 | 136 | ||
137 | p = simple_get_bytes(p, end, &ctx->initiate, sizeof(ctx->initiate)); | 137 | p = simple_get_bytes(p, end, &ctx->initiate, sizeof(ctx->initiate)); |
diff --git a/net/sunrpc/auth_gss/gss_spkm3_mech.c b/net/sunrpc/auth_gss/gss_spkm3_mech.c index 5deb4b6e4514..035e1dd6af1b 100644 --- a/net/sunrpc/auth_gss/gss_spkm3_mech.c +++ b/net/sunrpc/auth_gss/gss_spkm3_mech.c | |||
@@ -76,7 +76,7 @@ simple_get_netobj(const void *p, const void *end, struct xdr_netobj *res) | |||
76 | q = (const void *)((const char *)p + len); | 76 | q = (const void *)((const char *)p + len); |
77 | if (unlikely(q > end || q < p)) | 77 | if (unlikely(q > end || q < p)) |
78 | return ERR_PTR(-EFAULT); | 78 | return ERR_PTR(-EFAULT); |
79 | res->data = kmemdup(p, len, GFP_KERNEL); | 79 | res->data = kmemdup(p, len, GFP_NOFS); |
80 | if (unlikely(res->data == NULL)) | 80 | if (unlikely(res->data == NULL)) |
81 | return ERR_PTR(-ENOMEM); | 81 | return ERR_PTR(-ENOMEM); |
82 | return q; | 82 | return q; |
@@ -90,7 +90,7 @@ gss_import_sec_context_spkm3(const void *p, size_t len, | |||
90 | struct spkm3_ctx *ctx; | 90 | struct spkm3_ctx *ctx; |
91 | int version; | 91 | int version; |
92 | 92 | ||
93 | if (!(ctx = kzalloc(sizeof(*ctx), GFP_KERNEL))) | 93 | if (!(ctx = kzalloc(sizeof(*ctx), GFP_NOFS))) |
94 | goto out_err; | 94 | goto out_err; |
95 | 95 | ||
96 | p = simple_get_bytes(p, end, &version, sizeof(version)); | 96 | p = simple_get_bytes(p, end, &version, sizeof(version)); |
diff --git a/net/sunrpc/auth_gss/gss_spkm3_token.c b/net/sunrpc/auth_gss/gss_spkm3_token.c index 6cdd241ad267..3308157436d2 100644 --- a/net/sunrpc/auth_gss/gss_spkm3_token.c +++ b/net/sunrpc/auth_gss/gss_spkm3_token.c | |||
@@ -90,7 +90,7 @@ asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits) | |||
90 | int | 90 | int |
91 | decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, int explen) | 91 | decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, int explen) |
92 | { | 92 | { |
93 | if (!(out->data = kzalloc(explen,GFP_KERNEL))) | 93 | if (!(out->data = kzalloc(explen,GFP_NOFS))) |
94 | return 0; | 94 | return 0; |
95 | out->len = explen; | 95 | out->len = explen; |
96 | memcpy(out->data, in, enclen); | 96 | memcpy(out->data, in, enclen); |
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c index 44920b90bdc4..46b2647c5bd2 100644 --- a/net/sunrpc/auth_unix.c +++ b/net/sunrpc/auth_unix.c | |||
@@ -66,7 +66,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags) | |||
66 | dprintk("RPC: allocating UNIX cred for uid %d gid %d\n", | 66 | dprintk("RPC: allocating UNIX cred for uid %d gid %d\n", |
67 | acred->uid, acred->gid); | 67 | acred->uid, acred->gid); |
68 | 68 | ||
69 | if (!(cred = kmalloc(sizeof(*cred), GFP_KERNEL))) | 69 | if (!(cred = kmalloc(sizeof(*cred), GFP_NOFS))) |
70 | return ERR_PTR(-ENOMEM); | 70 | return ERR_PTR(-ENOMEM); |
71 | 71 | ||
72 | rpcauth_init_cred(&cred->uc_base, acred, auth, &unix_credops); | 72 | rpcauth_init_cred(&cred->uc_base, acred, auth, &unix_credops); |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 8945307556ec..76739e928d0d 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/kallsyms.h> | ||
28 | #include <linux/mm.h> | 29 | #include <linux/mm.h> |
29 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
30 | #include <linux/smp_lock.h> | 31 | #include <linux/smp_lock.h> |
@@ -58,7 +59,6 @@ static void call_start(struct rpc_task *task); | |||
58 | static void call_reserve(struct rpc_task *task); | 59 | static void call_reserve(struct rpc_task *task); |
59 | static void call_reserveresult(struct rpc_task *task); | 60 | static void call_reserveresult(struct rpc_task *task); |
60 | static void call_allocate(struct rpc_task *task); | 61 | static void call_allocate(struct rpc_task *task); |
61 | static void call_encode(struct rpc_task *task); | ||
62 | static void call_decode(struct rpc_task *task); | 62 | static void call_decode(struct rpc_task *task); |
63 | static void call_bind(struct rpc_task *task); | 63 | static void call_bind(struct rpc_task *task); |
64 | static void call_bind_status(struct rpc_task *task); | 64 | static void call_bind_status(struct rpc_task *task); |
@@ -70,9 +70,9 @@ static void call_refreshresult(struct rpc_task *task); | |||
70 | static void call_timeout(struct rpc_task *task); | 70 | static void call_timeout(struct rpc_task *task); |
71 | static void call_connect(struct rpc_task *task); | 71 | static void call_connect(struct rpc_task *task); |
72 | static void call_connect_status(struct rpc_task *task); | 72 | static void call_connect_status(struct rpc_task *task); |
73 | static __be32 * call_header(struct rpc_task *task); | ||
74 | static __be32 * call_verify(struct rpc_task *task); | ||
75 | 73 | ||
74 | static __be32 *rpc_encode_header(struct rpc_task *task); | ||
75 | static __be32 *rpc_verify_header(struct rpc_task *task); | ||
76 | static int rpc_ping(struct rpc_clnt *clnt, int flags); | 76 | static int rpc_ping(struct rpc_clnt *clnt, int flags); |
77 | 77 | ||
78 | static void rpc_register_client(struct rpc_clnt *clnt) | 78 | static void rpc_register_client(struct rpc_clnt *clnt) |
@@ -324,6 +324,8 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
324 | clnt->cl_autobind = 1; | 324 | clnt->cl_autobind = 1; |
325 | if (args->flags & RPC_CLNT_CREATE_DISCRTRY) | 325 | if (args->flags & RPC_CLNT_CREATE_DISCRTRY) |
326 | clnt->cl_discrtry = 1; | 326 | clnt->cl_discrtry = 1; |
327 | if (!(args->flags & RPC_CLNT_CREATE_QUIET)) | ||
328 | clnt->cl_chatty = 1; | ||
327 | 329 | ||
328 | return clnt; | 330 | return clnt; |
329 | } | 331 | } |
@@ -690,6 +692,21 @@ rpc_restart_call(struct rpc_task *task) | |||
690 | } | 692 | } |
691 | EXPORT_SYMBOL_GPL(rpc_restart_call); | 693 | EXPORT_SYMBOL_GPL(rpc_restart_call); |
692 | 694 | ||
695 | #ifdef RPC_DEBUG | ||
696 | static const char *rpc_proc_name(const struct rpc_task *task) | ||
697 | { | ||
698 | const struct rpc_procinfo *proc = task->tk_msg.rpc_proc; | ||
699 | |||
700 | if (proc) { | ||
701 | if (proc->p_name) | ||
702 | return proc->p_name; | ||
703 | else | ||
704 | return "NULL"; | ||
705 | } else | ||
706 | return "no proc"; | ||
707 | } | ||
708 | #endif | ||
709 | |||
693 | /* | 710 | /* |
694 | * 0. Initial state | 711 | * 0. Initial state |
695 | * | 712 | * |
@@ -701,9 +718,9 @@ call_start(struct rpc_task *task) | |||
701 | { | 718 | { |
702 | struct rpc_clnt *clnt = task->tk_client; | 719 | struct rpc_clnt *clnt = task->tk_client; |
703 | 720 | ||
704 | dprintk("RPC: %5u call_start %s%d proc %d (%s)\n", task->tk_pid, | 721 | dprintk("RPC: %5u call_start %s%d proc %s (%s)\n", task->tk_pid, |
705 | clnt->cl_protname, clnt->cl_vers, | 722 | clnt->cl_protname, clnt->cl_vers, |
706 | task->tk_msg.rpc_proc->p_proc, | 723 | rpc_proc_name(task), |
707 | (RPC_IS_ASYNC(task) ? "async" : "sync")); | 724 | (RPC_IS_ASYNC(task) ? "async" : "sync")); |
708 | 725 | ||
709 | /* Increment call count */ | 726 | /* Increment call count */ |
@@ -861,7 +878,7 @@ rpc_xdr_buf_init(struct xdr_buf *buf, void *start, size_t len) | |||
861 | * 3. Encode arguments of an RPC call | 878 | * 3. Encode arguments of an RPC call |
862 | */ | 879 | */ |
863 | static void | 880 | static void |
864 | call_encode(struct rpc_task *task) | 881 | rpc_xdr_encode(struct rpc_task *task) |
865 | { | 882 | { |
866 | struct rpc_rqst *req = task->tk_rqstp; | 883 | struct rpc_rqst *req = task->tk_rqstp; |
867 | kxdrproc_t encode; | 884 | kxdrproc_t encode; |
@@ -876,23 +893,19 @@ call_encode(struct rpc_task *task) | |||
876 | (char *)req->rq_buffer + req->rq_callsize, | 893 | (char *)req->rq_buffer + req->rq_callsize, |
877 | req->rq_rcvsize); | 894 | req->rq_rcvsize); |
878 | 895 | ||
879 | /* Encode header and provided arguments */ | 896 | p = rpc_encode_header(task); |
880 | encode = task->tk_msg.rpc_proc->p_encode; | 897 | if (p == NULL) { |
881 | if (!(p = call_header(task))) { | 898 | printk(KERN_INFO "RPC: couldn't encode RPC header, exit EIO\n"); |
882 | printk(KERN_INFO "RPC: call_header failed, exit EIO\n"); | ||
883 | rpc_exit(task, -EIO); | 899 | rpc_exit(task, -EIO); |
884 | return; | 900 | return; |
885 | } | 901 | } |
902 | |||
903 | encode = task->tk_msg.rpc_proc->p_encode; | ||
886 | if (encode == NULL) | 904 | if (encode == NULL) |
887 | return; | 905 | return; |
888 | 906 | ||
889 | task->tk_status = rpcauth_wrap_req(task, encode, req, p, | 907 | task->tk_status = rpcauth_wrap_req(task, encode, req, p, |
890 | task->tk_msg.rpc_argp); | 908 | task->tk_msg.rpc_argp); |
891 | if (task->tk_status == -ENOMEM) { | ||
892 | /* XXX: Is this sane? */ | ||
893 | rpc_delay(task, 3*HZ); | ||
894 | task->tk_status = -EAGAIN; | ||
895 | } | ||
896 | } | 909 | } |
897 | 910 | ||
898 | /* | 911 | /* |
@@ -929,11 +942,9 @@ call_bind_status(struct rpc_task *task) | |||
929 | } | 942 | } |
930 | 943 | ||
931 | switch (task->tk_status) { | 944 | switch (task->tk_status) { |
932 | case -EAGAIN: | 945 | case -ENOMEM: |
933 | dprintk("RPC: %5u rpcbind waiting for another request " | 946 | dprintk("RPC: %5u rpcbind out of memory\n", task->tk_pid); |
934 | "to finish\n", task->tk_pid); | 947 | rpc_delay(task, HZ >> 2); |
935 | /* avoid busy-waiting here -- could be a network outage. */ | ||
936 | rpc_delay(task, 5*HZ); | ||
937 | goto retry_timeout; | 948 | goto retry_timeout; |
938 | case -EACCES: | 949 | case -EACCES: |
939 | dprintk("RPC: %5u remote rpcbind: RPC program/version " | 950 | dprintk("RPC: %5u remote rpcbind: RPC program/version " |
@@ -1046,10 +1057,16 @@ call_transmit(struct rpc_task *task) | |||
1046 | /* Encode here so that rpcsec_gss can use correct sequence number. */ | 1057 | /* Encode here so that rpcsec_gss can use correct sequence number. */ |
1047 | if (rpc_task_need_encode(task)) { | 1058 | if (rpc_task_need_encode(task)) { |
1048 | BUG_ON(task->tk_rqstp->rq_bytes_sent != 0); | 1059 | BUG_ON(task->tk_rqstp->rq_bytes_sent != 0); |
1049 | call_encode(task); | 1060 | rpc_xdr_encode(task); |
1050 | /* Did the encode result in an error condition? */ | 1061 | /* Did the encode result in an error condition? */ |
1051 | if (task->tk_status != 0) | 1062 | if (task->tk_status != 0) { |
1063 | /* Was the error nonfatal? */ | ||
1064 | if (task->tk_status == -EAGAIN) | ||
1065 | rpc_delay(task, HZ >> 4); | ||
1066 | else | ||
1067 | rpc_exit(task, task->tk_status); | ||
1052 | return; | 1068 | return; |
1069 | } | ||
1053 | } | 1070 | } |
1054 | xprt_transmit(task); | 1071 | xprt_transmit(task); |
1055 | if (task->tk_status < 0) | 1072 | if (task->tk_status < 0) |
@@ -1132,7 +1149,8 @@ call_status(struct rpc_task *task) | |||
1132 | rpc_exit(task, status); | 1149 | rpc_exit(task, status); |
1133 | break; | 1150 | break; |
1134 | default: | 1151 | default: |
1135 | printk("%s: RPC call returned error %d\n", | 1152 | if (clnt->cl_chatty) |
1153 | printk("%s: RPC call returned error %d\n", | ||
1136 | clnt->cl_protname, -status); | 1154 | clnt->cl_protname, -status); |
1137 | rpc_exit(task, status); | 1155 | rpc_exit(task, status); |
1138 | } | 1156 | } |
@@ -1157,7 +1175,8 @@ call_timeout(struct rpc_task *task) | |||
1157 | task->tk_timeouts++; | 1175 | task->tk_timeouts++; |
1158 | 1176 | ||
1159 | if (RPC_IS_SOFT(task)) { | 1177 | if (RPC_IS_SOFT(task)) { |
1160 | printk(KERN_NOTICE "%s: server %s not responding, timed out\n", | 1178 | if (clnt->cl_chatty) |
1179 | printk(KERN_NOTICE "%s: server %s not responding, timed out\n", | ||
1161 | clnt->cl_protname, clnt->cl_server); | 1180 | clnt->cl_protname, clnt->cl_server); |
1162 | rpc_exit(task, -EIO); | 1181 | rpc_exit(task, -EIO); |
1163 | return; | 1182 | return; |
@@ -1165,7 +1184,8 @@ call_timeout(struct rpc_task *task) | |||
1165 | 1184 | ||
1166 | if (!(task->tk_flags & RPC_CALL_MAJORSEEN)) { | 1185 | if (!(task->tk_flags & RPC_CALL_MAJORSEEN)) { |
1167 | task->tk_flags |= RPC_CALL_MAJORSEEN; | 1186 | task->tk_flags |= RPC_CALL_MAJORSEEN; |
1168 | printk(KERN_NOTICE "%s: server %s not responding, still trying\n", | 1187 | if (clnt->cl_chatty) |
1188 | printk(KERN_NOTICE "%s: server %s not responding, still trying\n", | ||
1169 | clnt->cl_protname, clnt->cl_server); | 1189 | clnt->cl_protname, clnt->cl_server); |
1170 | } | 1190 | } |
1171 | rpc_force_rebind(clnt); | 1191 | rpc_force_rebind(clnt); |
@@ -1196,8 +1216,9 @@ call_decode(struct rpc_task *task) | |||
1196 | task->tk_pid, task->tk_status); | 1216 | task->tk_pid, task->tk_status); |
1197 | 1217 | ||
1198 | if (task->tk_flags & RPC_CALL_MAJORSEEN) { | 1218 | if (task->tk_flags & RPC_CALL_MAJORSEEN) { |
1199 | printk(KERN_NOTICE "%s: server %s OK\n", | 1219 | if (clnt->cl_chatty) |
1200 | clnt->cl_protname, clnt->cl_server); | 1220 | printk(KERN_NOTICE "%s: server %s OK\n", |
1221 | clnt->cl_protname, clnt->cl_server); | ||
1201 | task->tk_flags &= ~RPC_CALL_MAJORSEEN; | 1222 | task->tk_flags &= ~RPC_CALL_MAJORSEEN; |
1202 | } | 1223 | } |
1203 | 1224 | ||
@@ -1224,8 +1245,7 @@ call_decode(struct rpc_task *task) | |||
1224 | goto out_retry; | 1245 | goto out_retry; |
1225 | } | 1246 | } |
1226 | 1247 | ||
1227 | /* Verify the RPC header */ | 1248 | p = rpc_verify_header(task); |
1228 | p = call_verify(task); | ||
1229 | if (IS_ERR(p)) { | 1249 | if (IS_ERR(p)) { |
1230 | if (p == ERR_PTR(-EAGAIN)) | 1250 | if (p == ERR_PTR(-EAGAIN)) |
1231 | goto out_retry; | 1251 | goto out_retry; |
@@ -1243,7 +1263,7 @@ call_decode(struct rpc_task *task) | |||
1243 | return; | 1263 | return; |
1244 | out_retry: | 1264 | out_retry: |
1245 | task->tk_status = 0; | 1265 | task->tk_status = 0; |
1246 | /* Note: call_verify() may have freed the RPC slot */ | 1266 | /* Note: rpc_verify_header() may have freed the RPC slot */ |
1247 | if (task->tk_rqstp == req) { | 1267 | if (task->tk_rqstp == req) { |
1248 | req->rq_received = req->rq_rcv_buf.len = 0; | 1268 | req->rq_received = req->rq_rcv_buf.len = 0; |
1249 | if (task->tk_client->cl_discrtry) | 1269 | if (task->tk_client->cl_discrtry) |
@@ -1290,11 +1310,8 @@ call_refreshresult(struct rpc_task *task) | |||
1290 | return; | 1310 | return; |
1291 | } | 1311 | } |
1292 | 1312 | ||
1293 | /* | ||
1294 | * Call header serialization | ||
1295 | */ | ||
1296 | static __be32 * | 1313 | static __be32 * |
1297 | call_header(struct rpc_task *task) | 1314 | rpc_encode_header(struct rpc_task *task) |
1298 | { | 1315 | { |
1299 | struct rpc_clnt *clnt = task->tk_client; | 1316 | struct rpc_clnt *clnt = task->tk_client; |
1300 | struct rpc_rqst *req = task->tk_rqstp; | 1317 | struct rpc_rqst *req = task->tk_rqstp; |
@@ -1314,11 +1331,8 @@ call_header(struct rpc_task *task) | |||
1314 | return p; | 1331 | return p; |
1315 | } | 1332 | } |
1316 | 1333 | ||
1317 | /* | ||
1318 | * Reply header verification | ||
1319 | */ | ||
1320 | static __be32 * | 1334 | static __be32 * |
1321 | call_verify(struct rpc_task *task) | 1335 | rpc_verify_header(struct rpc_task *task) |
1322 | { | 1336 | { |
1323 | struct kvec *iov = &task->tk_rqstp->rq_rcv_buf.head[0]; | 1337 | struct kvec *iov = &task->tk_rqstp->rq_rcv_buf.head[0]; |
1324 | int len = task->tk_rqstp->rq_rcv_buf.len >> 2; | 1338 | int len = task->tk_rqstp->rq_rcv_buf.len >> 2; |
@@ -1392,7 +1406,7 @@ call_verify(struct rpc_task *task) | |||
1392 | task->tk_action = call_bind; | 1406 | task->tk_action = call_bind; |
1393 | goto out_retry; | 1407 | goto out_retry; |
1394 | case RPC_AUTH_TOOWEAK: | 1408 | case RPC_AUTH_TOOWEAK: |
1395 | printk(KERN_NOTICE "call_verify: server %s requires stronger " | 1409 | printk(KERN_NOTICE "RPC: server %s requires stronger " |
1396 | "authentication.\n", task->tk_client->cl_server); | 1410 | "authentication.\n", task->tk_client->cl_server); |
1397 | break; | 1411 | break; |
1398 | default: | 1412 | default: |
@@ -1431,10 +1445,10 @@ call_verify(struct rpc_task *task) | |||
1431 | error = -EPROTONOSUPPORT; | 1445 | error = -EPROTONOSUPPORT; |
1432 | goto out_err; | 1446 | goto out_err; |
1433 | case RPC_PROC_UNAVAIL: | 1447 | case RPC_PROC_UNAVAIL: |
1434 | dprintk("RPC: %5u %s: proc %p unsupported by program %u, " | 1448 | dprintk("RPC: %5u %s: proc %s unsupported by program %u, " |
1435 | "version %u on server %s\n", | 1449 | "version %u on server %s\n", |
1436 | task->tk_pid, __func__, | 1450 | task->tk_pid, __func__, |
1437 | task->tk_msg.rpc_proc, | 1451 | rpc_proc_name(task), |
1438 | task->tk_client->cl_prog, | 1452 | task->tk_client->cl_prog, |
1439 | task->tk_client->cl_vers, | 1453 | task->tk_client->cl_vers, |
1440 | task->tk_client->cl_server); | 1454 | task->tk_client->cl_server); |
@@ -1517,44 +1531,53 @@ struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, int | |||
1517 | EXPORT_SYMBOL_GPL(rpc_call_null); | 1531 | EXPORT_SYMBOL_GPL(rpc_call_null); |
1518 | 1532 | ||
1519 | #ifdef RPC_DEBUG | 1533 | #ifdef RPC_DEBUG |
1534 | static void rpc_show_header(void) | ||
1535 | { | ||
1536 | printk(KERN_INFO "-pid- flgs status -client- --rqstp- " | ||
1537 | "-timeout ---ops--\n"); | ||
1538 | } | ||
1539 | |||
1540 | static void rpc_show_task(const struct rpc_clnt *clnt, | ||
1541 | const struct rpc_task *task) | ||
1542 | { | ||
1543 | const char *rpc_waitq = "none"; | ||
1544 | char *p, action[KSYM_SYMBOL_LEN]; | ||
1545 | |||
1546 | if (RPC_IS_QUEUED(task)) | ||
1547 | rpc_waitq = rpc_qname(task->tk_waitqueue); | ||
1548 | |||
1549 | /* map tk_action pointer to a function name; then trim off | ||
1550 | * the "+0x0 [sunrpc]" */ | ||
1551 | sprint_symbol(action, (unsigned long)task->tk_action); | ||
1552 | p = strchr(action, '+'); | ||
1553 | if (p) | ||
1554 | *p = '\0'; | ||
1555 | |||
1556 | printk(KERN_INFO "%5u %04x %6d %8p %8p %8ld %8p %sv%u %s a:%s q:%s\n", | ||
1557 | task->tk_pid, task->tk_flags, task->tk_status, | ||
1558 | clnt, task->tk_rqstp, task->tk_timeout, task->tk_ops, | ||
1559 | clnt->cl_protname, clnt->cl_vers, rpc_proc_name(task), | ||
1560 | action, rpc_waitq); | ||
1561 | } | ||
1562 | |||
1520 | void rpc_show_tasks(void) | 1563 | void rpc_show_tasks(void) |
1521 | { | 1564 | { |
1522 | struct rpc_clnt *clnt; | 1565 | struct rpc_clnt *clnt; |
1523 | struct rpc_task *t; | 1566 | struct rpc_task *task; |
1567 | int header = 0; | ||
1524 | 1568 | ||
1525 | spin_lock(&rpc_client_lock); | 1569 | spin_lock(&rpc_client_lock); |
1526 | if (list_empty(&all_clients)) | ||
1527 | goto out; | ||
1528 | printk("-pid- proc flgs status -client- -prog- --rqstp- -timeout " | ||
1529 | "-rpcwait -action- ---ops--\n"); | ||
1530 | list_for_each_entry(clnt, &all_clients, cl_clients) { | 1570 | list_for_each_entry(clnt, &all_clients, cl_clients) { |
1531 | if (list_empty(&clnt->cl_tasks)) | ||
1532 | continue; | ||
1533 | spin_lock(&clnt->cl_lock); | 1571 | spin_lock(&clnt->cl_lock); |
1534 | list_for_each_entry(t, &clnt->cl_tasks, tk_task) { | 1572 | list_for_each_entry(task, &clnt->cl_tasks, tk_task) { |
1535 | const char *rpc_waitq = "none"; | 1573 | if (!header) { |
1536 | int proc; | 1574 | rpc_show_header(); |
1537 | 1575 | header++; | |
1538 | if (t->tk_msg.rpc_proc) | 1576 | } |
1539 | proc = t->tk_msg.rpc_proc->p_proc; | 1577 | rpc_show_task(clnt, task); |
1540 | else | ||
1541 | proc = -1; | ||
1542 | |||
1543 | if (RPC_IS_QUEUED(t)) | ||
1544 | rpc_waitq = rpc_qname(t->tk_waitqueue); | ||
1545 | |||
1546 | printk("%5u %04d %04x %6d %8p %6d %8p %8ld %8s %8p %8p\n", | ||
1547 | t->tk_pid, proc, | ||
1548 | t->tk_flags, t->tk_status, | ||
1549 | t->tk_client, | ||
1550 | (t->tk_client ? t->tk_client->cl_prog : 0), | ||
1551 | t->tk_rqstp, t->tk_timeout, | ||
1552 | rpc_waitq, | ||
1553 | t->tk_action, t->tk_ops); | ||
1554 | } | 1578 | } |
1555 | spin_unlock(&clnt->cl_lock); | 1579 | spin_unlock(&clnt->cl_lock); |
1556 | } | 1580 | } |
1557 | out: | ||
1558 | spin_unlock(&rpc_client_lock); | 1581 | spin_unlock(&rpc_client_lock); |
1559 | } | 1582 | } |
1560 | #endif | 1583 | #endif |
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index e6fb21b19b86..24db2b4d12d3 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -32,6 +32,10 @@ | |||
32 | #define RPCBIND_PROGRAM (100000u) | 32 | #define RPCBIND_PROGRAM (100000u) |
33 | #define RPCBIND_PORT (111u) | 33 | #define RPCBIND_PORT (111u) |
34 | 34 | ||
35 | #define RPCBVERS_2 (2u) | ||
36 | #define RPCBVERS_3 (3u) | ||
37 | #define RPCBVERS_4 (4u) | ||
38 | |||
35 | enum { | 39 | enum { |
36 | RPCBPROC_NULL, | 40 | RPCBPROC_NULL, |
37 | RPCBPROC_SET, | 41 | RPCBPROC_SET, |
@@ -64,6 +68,7 @@ enum { | |||
64 | #define RPCB_MAXOWNERLEN sizeof(RPCB_OWNER_STRING) | 68 | #define RPCB_MAXOWNERLEN sizeof(RPCB_OWNER_STRING) |
65 | 69 | ||
66 | static void rpcb_getport_done(struct rpc_task *, void *); | 70 | static void rpcb_getport_done(struct rpc_task *, void *); |
71 | static void rpcb_map_release(void *data); | ||
67 | static struct rpc_program rpcb_program; | 72 | static struct rpc_program rpcb_program; |
68 | 73 | ||
69 | struct rpcbind_args { | 74 | struct rpcbind_args { |
@@ -76,41 +81,73 @@ struct rpcbind_args { | |||
76 | const char * r_netid; | 81 | const char * r_netid; |
77 | const char * r_addr; | 82 | const char * r_addr; |
78 | const char * r_owner; | 83 | const char * r_owner; |
84 | |||
85 | int r_status; | ||
79 | }; | 86 | }; |
80 | 87 | ||
81 | static struct rpc_procinfo rpcb_procedures2[]; | 88 | static struct rpc_procinfo rpcb_procedures2[]; |
82 | static struct rpc_procinfo rpcb_procedures3[]; | 89 | static struct rpc_procinfo rpcb_procedures3[]; |
90 | static struct rpc_procinfo rpcb_procedures4[]; | ||
83 | 91 | ||
84 | struct rpcb_info { | 92 | struct rpcb_info { |
85 | int rpc_vers; | 93 | u32 rpc_vers; |
86 | struct rpc_procinfo * rpc_proc; | 94 | struct rpc_procinfo * rpc_proc; |
87 | }; | 95 | }; |
88 | 96 | ||
89 | static struct rpcb_info rpcb_next_version[]; | 97 | static struct rpcb_info rpcb_next_version[]; |
90 | static struct rpcb_info rpcb_next_version6[]; | 98 | static struct rpcb_info rpcb_next_version6[]; |
91 | 99 | ||
100 | static const struct rpc_call_ops rpcb_getport_ops = { | ||
101 | .rpc_call_done = rpcb_getport_done, | ||
102 | .rpc_release = rpcb_map_release, | ||
103 | }; | ||
104 | |||
105 | static void rpcb_wake_rpcbind_waiters(struct rpc_xprt *xprt, int status) | ||
106 | { | ||
107 | xprt_clear_binding(xprt); | ||
108 | rpc_wake_up_status(&xprt->binding, status); | ||
109 | } | ||
110 | |||
92 | static void rpcb_map_release(void *data) | 111 | static void rpcb_map_release(void *data) |
93 | { | 112 | { |
94 | struct rpcbind_args *map = data; | 113 | struct rpcbind_args *map = data; |
95 | 114 | ||
115 | rpcb_wake_rpcbind_waiters(map->r_xprt, map->r_status); | ||
96 | xprt_put(map->r_xprt); | 116 | xprt_put(map->r_xprt); |
97 | kfree(map); | 117 | kfree(map); |
98 | } | 118 | } |
99 | 119 | ||
100 | static const struct rpc_call_ops rpcb_getport_ops = { | 120 | static const struct sockaddr_in rpcb_inaddr_loopback = { |
101 | .rpc_call_done = rpcb_getport_done, | 121 | .sin_family = AF_INET, |
102 | .rpc_release = rpcb_map_release, | 122 | .sin_addr.s_addr = htonl(INADDR_LOOPBACK), |
123 | .sin_port = htons(RPCBIND_PORT), | ||
103 | }; | 124 | }; |
104 | 125 | ||
105 | static void rpcb_wake_rpcbind_waiters(struct rpc_xprt *xprt, int status) | 126 | static const struct sockaddr_in6 rpcb_in6addr_loopback = { |
127 | .sin6_family = AF_INET6, | ||
128 | .sin6_addr = IN6ADDR_LOOPBACK_INIT, | ||
129 | .sin6_port = htons(RPCBIND_PORT), | ||
130 | }; | ||
131 | |||
132 | static struct rpc_clnt *rpcb_create_local(struct sockaddr *addr, | ||
133 | size_t addrlen, u32 version) | ||
106 | { | 134 | { |
107 | xprt_clear_binding(xprt); | 135 | struct rpc_create_args args = { |
108 | rpc_wake_up_status(&xprt->binding, status); | 136 | .protocol = XPRT_TRANSPORT_UDP, |
137 | .address = addr, | ||
138 | .addrsize = addrlen, | ||
139 | .servername = "localhost", | ||
140 | .program = &rpcb_program, | ||
141 | .version = version, | ||
142 | .authflavor = RPC_AUTH_UNIX, | ||
143 | .flags = RPC_CLNT_CREATE_NOPING, | ||
144 | }; | ||
145 | |||
146 | return rpc_create(&args); | ||
109 | } | 147 | } |
110 | 148 | ||
111 | static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, | 149 | static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, |
112 | size_t salen, int proto, u32 version, | 150 | size_t salen, int proto, u32 version) |
113 | int privileged) | ||
114 | { | 151 | { |
115 | struct rpc_create_args args = { | 152 | struct rpc_create_args args = { |
116 | .protocol = proto, | 153 | .protocol = proto, |
@@ -120,7 +157,8 @@ static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, | |||
120 | .program = &rpcb_program, | 157 | .program = &rpcb_program, |
121 | .version = version, | 158 | .version = version, |
122 | .authflavor = RPC_AUTH_UNIX, | 159 | .authflavor = RPC_AUTH_UNIX, |
123 | .flags = RPC_CLNT_CREATE_NOPING, | 160 | .flags = (RPC_CLNT_CREATE_NOPING | |
161 | RPC_CLNT_CREATE_NONPRIVPORT), | ||
124 | }; | 162 | }; |
125 | 163 | ||
126 | switch (srvaddr->sa_family) { | 164 | switch (srvaddr->sa_family) { |
@@ -134,29 +172,72 @@ static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, | |||
134 | return NULL; | 172 | return NULL; |
135 | } | 173 | } |
136 | 174 | ||
137 | if (!privileged) | ||
138 | args.flags |= RPC_CLNT_CREATE_NONPRIVPORT; | ||
139 | return rpc_create(&args); | 175 | return rpc_create(&args); |
140 | } | 176 | } |
141 | 177 | ||
178 | static int rpcb_register_call(struct sockaddr *addr, size_t addrlen, | ||
179 | u32 version, struct rpc_message *msg, | ||
180 | int *result) | ||
181 | { | ||
182 | struct rpc_clnt *rpcb_clnt; | ||
183 | int error = 0; | ||
184 | |||
185 | *result = 0; | ||
186 | |||
187 | rpcb_clnt = rpcb_create_local(addr, addrlen, version); | ||
188 | if (!IS_ERR(rpcb_clnt)) { | ||
189 | error = rpc_call_sync(rpcb_clnt, msg, 0); | ||
190 | rpc_shutdown_client(rpcb_clnt); | ||
191 | } else | ||
192 | error = PTR_ERR(rpcb_clnt); | ||
193 | |||
194 | if (error < 0) | ||
195 | printk(KERN_WARNING "RPC: failed to contact local rpcbind " | ||
196 | "server (errno %d).\n", -error); | ||
197 | dprintk("RPC: registration status %d/%d\n", error, *result); | ||
198 | |||
199 | return error; | ||
200 | } | ||
201 | |||
142 | /** | 202 | /** |
143 | * rpcb_register - set or unset a port registration with the local rpcbind svc | 203 | * rpcb_register - set or unset a port registration with the local rpcbind svc |
144 | * @prog: RPC program number to bind | 204 | * @prog: RPC program number to bind |
145 | * @vers: RPC version number to bind | 205 | * @vers: RPC version number to bind |
146 | * @prot: transport protocol to use to make this request | 206 | * @prot: transport protocol to register |
147 | * @port: port value to register | 207 | * @port: port value to register |
148 | * @okay: result code | 208 | * @okay: OUT: result code |
209 | * | ||
210 | * RPC services invoke this function to advertise their contact | ||
211 | * information via the system's rpcbind daemon. RPC services | ||
212 | * invoke this function once for each [program, version, transport] | ||
213 | * tuple they wish to advertise. | ||
214 | * | ||
215 | * Callers may also unregister RPC services that are no longer | ||
216 | * available by setting the passed-in port to zero. This removes | ||
217 | * all registered transports for [program, version] from the local | ||
218 | * rpcbind database. | ||
219 | * | ||
220 | * Returns zero if the registration request was dispatched | ||
221 | * successfully and a reply was received. The rpcbind daemon's | ||
222 | * boolean result code is stored in *okay. | ||
223 | * | ||
224 | * Returns an errno value and sets *result to zero if there was | ||
225 | * some problem that prevented the rpcbind request from being | ||
226 | * dispatched, or if the rpcbind daemon did not respond within | ||
227 | * the timeout. | ||
149 | * | 228 | * |
150 | * port == 0 means unregister, port != 0 means register. | 229 | * This function uses rpcbind protocol version 2 to contact the |
230 | * local rpcbind daemon. | ||
151 | * | 231 | * |
152 | * This routine supports only rpcbind version 2. | 232 | * Registration works over both AF_INET and AF_INET6, and services |
233 | * registered via this function are advertised as available for any | ||
234 | * address. If the local rpcbind daemon is listening on AF_INET6, | ||
235 | * services registered via this function will be advertised on | ||
236 | * IN6ADDR_ANY (ie available for all AF_INET and AF_INET6 | ||
237 | * addresses). | ||
153 | */ | 238 | */ |
154 | int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay) | 239 | int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay) |
155 | { | 240 | { |
156 | struct sockaddr_in sin = { | ||
157 | .sin_family = AF_INET, | ||
158 | .sin_addr.s_addr = htonl(INADDR_LOOPBACK), | ||
159 | }; | ||
160 | struct rpcbind_args map = { | 241 | struct rpcbind_args map = { |
161 | .r_prog = prog, | 242 | .r_prog = prog, |
162 | .r_vers = vers, | 243 | .r_vers = vers, |
@@ -164,32 +245,159 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay) | |||
164 | .r_port = port, | 245 | .r_port = port, |
165 | }; | 246 | }; |
166 | struct rpc_message msg = { | 247 | struct rpc_message msg = { |
167 | .rpc_proc = &rpcb_procedures2[port ? | ||
168 | RPCBPROC_SET : RPCBPROC_UNSET], | ||
169 | .rpc_argp = &map, | 248 | .rpc_argp = &map, |
170 | .rpc_resp = okay, | 249 | .rpc_resp = okay, |
171 | }; | 250 | }; |
172 | struct rpc_clnt *rpcb_clnt; | ||
173 | int error = 0; | ||
174 | 251 | ||
175 | dprintk("RPC: %sregistering (%u, %u, %d, %u) with local " | 252 | dprintk("RPC: %sregistering (%u, %u, %d, %u) with local " |
176 | "rpcbind\n", (port ? "" : "un"), | 253 | "rpcbind\n", (port ? "" : "un"), |
177 | prog, vers, prot, port); | 254 | prog, vers, prot, port); |
178 | 255 | ||
179 | rpcb_clnt = rpcb_create("localhost", (struct sockaddr *) &sin, | 256 | msg.rpc_proc = &rpcb_procedures2[RPCBPROC_UNSET]; |
180 | sizeof(sin), XPRT_TRANSPORT_UDP, 2, 1); | 257 | if (port) |
181 | if (IS_ERR(rpcb_clnt)) | 258 | msg.rpc_proc = &rpcb_procedures2[RPCBPROC_SET]; |
182 | return PTR_ERR(rpcb_clnt); | ||
183 | 259 | ||
184 | error = rpc_call_sync(rpcb_clnt, &msg, 0); | 260 | return rpcb_register_call((struct sockaddr *)&rpcb_inaddr_loopback, |
261 | sizeof(rpcb_inaddr_loopback), | ||
262 | RPCBVERS_2, &msg, okay); | ||
263 | } | ||
185 | 264 | ||
186 | rpc_shutdown_client(rpcb_clnt); | 265 | /* |
187 | if (error < 0) | 266 | * Fill in AF_INET family-specific arguments to register |
188 | printk(KERN_WARNING "RPC: failed to contact local rpcbind " | 267 | */ |
189 | "server (errno %d).\n", -error); | 268 | static int rpcb_register_netid4(struct sockaddr_in *address_to_register, |
190 | dprintk("RPC: registration status %d/%d\n", error, *okay); | 269 | struct rpc_message *msg) |
270 | { | ||
271 | struct rpcbind_args *map = msg->rpc_argp; | ||
272 | unsigned short port = ntohs(address_to_register->sin_port); | ||
273 | char buf[32]; | ||
274 | |||
275 | /* Construct AF_INET universal address */ | ||
276 | snprintf(buf, sizeof(buf), | ||
277 | NIPQUAD_FMT".%u.%u", | ||
278 | NIPQUAD(address_to_register->sin_addr.s_addr), | ||
279 | port >> 8, port & 0xff); | ||
280 | map->r_addr = buf; | ||
281 | |||
282 | dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with " | ||
283 | "local rpcbind\n", (port ? "" : "un"), | ||
284 | map->r_prog, map->r_vers, | ||
285 | map->r_addr, map->r_netid); | ||
286 | |||
287 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; | ||
288 | if (port) | ||
289 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; | ||
290 | |||
291 | return rpcb_register_call((struct sockaddr *)&rpcb_inaddr_loopback, | ||
292 | sizeof(rpcb_inaddr_loopback), | ||
293 | RPCBVERS_4, msg, msg->rpc_resp); | ||
294 | } | ||
191 | 295 | ||
192 | return error; | 296 | /* |
297 | * Fill in AF_INET6 family-specific arguments to register | ||
298 | */ | ||
299 | static int rpcb_register_netid6(struct sockaddr_in6 *address_to_register, | ||
300 | struct rpc_message *msg) | ||
301 | { | ||
302 | struct rpcbind_args *map = msg->rpc_argp; | ||
303 | unsigned short port = ntohs(address_to_register->sin6_port); | ||
304 | char buf[64]; | ||
305 | |||
306 | /* Construct AF_INET6 universal address */ | ||
307 | snprintf(buf, sizeof(buf), | ||
308 | NIP6_FMT".%u.%u", | ||
309 | NIP6(address_to_register->sin6_addr), | ||
310 | port >> 8, port & 0xff); | ||
311 | map->r_addr = buf; | ||
312 | |||
313 | dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with " | ||
314 | "local rpcbind\n", (port ? "" : "un"), | ||
315 | map->r_prog, map->r_vers, | ||
316 | map->r_addr, map->r_netid); | ||
317 | |||
318 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_UNSET]; | ||
319 | if (port) | ||
320 | msg->rpc_proc = &rpcb_procedures4[RPCBPROC_SET]; | ||
321 | |||
322 | return rpcb_register_call((struct sockaddr *)&rpcb_in6addr_loopback, | ||
323 | sizeof(rpcb_in6addr_loopback), | ||
324 | RPCBVERS_4, msg, msg->rpc_resp); | ||
325 | } | ||
326 | |||
327 | /** | ||
328 | * rpcb_v4_register - set or unset a port registration with the local rpcbind | ||
329 | * @program: RPC program number of service to (un)register | ||
330 | * @version: RPC version number of service to (un)register | ||
331 | * @address: address family, IP address, and port to (un)register | ||
332 | * @netid: netid of transport protocol to (un)register | ||
333 | * @result: result code from rpcbind RPC call | ||
334 | * | ||
335 | * RPC services invoke this function to advertise their contact | ||
336 | * information via the system's rpcbind daemon. RPC services | ||
337 | * invoke this function once for each [program, version, address, | ||
338 | * netid] tuple they wish to advertise. | ||
339 | * | ||
340 | * Callers may also unregister RPC services that are no longer | ||
341 | * available by setting the port number in the passed-in address | ||
342 | * to zero. Callers pass a netid of "" to unregister all | ||
343 | * transport netids associated with [program, version, address]. | ||
344 | * | ||
345 | * Returns zero if the registration request was dispatched | ||
346 | * successfully and a reply was received. The rpcbind daemon's | ||
347 | * result code is stored in *result. | ||
348 | * | ||
349 | * Returns an errno value and sets *result to zero if there was | ||
350 | * some problem that prevented the rpcbind request from being | ||
351 | * dispatched, or if the rpcbind daemon did not respond within | ||
352 | * the timeout. | ||
353 | * | ||
354 | * This function uses rpcbind protocol version 4 to contact the | ||
355 | * local rpcbind daemon. The local rpcbind daemon must support | ||
356 | * version 4 of the rpcbind protocol in order for these functions | ||
357 | * to register a service successfully. | ||
358 | * | ||
359 | * Supported netids include "udp" and "tcp" for UDP and TCP over | ||
360 | * IPv4, and "udp6" and "tcp6" for UDP and TCP over IPv6, | ||
361 | * respectively. | ||
362 | * | ||
363 | * The contents of @address determine the address family and the | ||
364 | * port to be registered. The usual practice is to pass INADDR_ANY | ||
365 | * as the raw address, but specifying a non-zero address is also | ||
366 | * supported by this API if the caller wishes to advertise an RPC | ||
367 | * service on a specific network interface. | ||
368 | * | ||
369 | * Note that passing in INADDR_ANY does not create the same service | ||
370 | * registration as IN6ADDR_ANY. The former advertises an RPC | ||
371 | * service on any IPv4 address, but not on IPv6. The latter | ||
372 | * advertises the service on all IPv4 and IPv6 addresses. | ||
373 | */ | ||
374 | int rpcb_v4_register(const u32 program, const u32 version, | ||
375 | const struct sockaddr *address, const char *netid, | ||
376 | int *result) | ||
377 | { | ||
378 | struct rpcbind_args map = { | ||
379 | .r_prog = program, | ||
380 | .r_vers = version, | ||
381 | .r_netid = netid, | ||
382 | .r_owner = RPCB_OWNER_STRING, | ||
383 | }; | ||
384 | struct rpc_message msg = { | ||
385 | .rpc_argp = &map, | ||
386 | .rpc_resp = result, | ||
387 | }; | ||
388 | |||
389 | *result = 0; | ||
390 | |||
391 | switch (address->sa_family) { | ||
392 | case AF_INET: | ||
393 | return rpcb_register_netid4((struct sockaddr_in *)address, | ||
394 | &msg); | ||
395 | case AF_INET6: | ||
396 | return rpcb_register_netid6((struct sockaddr_in6 *)address, | ||
397 | &msg); | ||
398 | } | ||
399 | |||
400 | return -EAFNOSUPPORT; | ||
193 | } | 401 | } |
194 | 402 | ||
195 | /** | 403 | /** |
@@ -227,7 +435,7 @@ int rpcb_getport_sync(struct sockaddr_in *sin, u32 prog, u32 vers, int prot) | |||
227 | __func__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot); | 435 | __func__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot); |
228 | 436 | ||
229 | rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin, | 437 | rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin, |
230 | sizeof(*sin), prot, 2, 0); | 438 | sizeof(*sin), prot, RPCBVERS_2); |
231 | if (IS_ERR(rpcb_clnt)) | 439 | if (IS_ERR(rpcb_clnt)) |
232 | return PTR_ERR(rpcb_clnt); | 440 | return PTR_ERR(rpcb_clnt); |
233 | 441 | ||
@@ -289,17 +497,16 @@ void rpcb_getport_async(struct rpc_task *task) | |||
289 | /* Autobind on cloned rpc clients is discouraged */ | 497 | /* Autobind on cloned rpc clients is discouraged */ |
290 | BUG_ON(clnt->cl_parent != clnt); | 498 | BUG_ON(clnt->cl_parent != clnt); |
291 | 499 | ||
500 | /* Put self on the wait queue to ensure we get notified if | ||
501 | * some other task is already attempting to bind the port */ | ||
502 | rpc_sleep_on(&xprt->binding, task, NULL); | ||
503 | |||
292 | if (xprt_test_and_set_binding(xprt)) { | 504 | if (xprt_test_and_set_binding(xprt)) { |
293 | status = -EAGAIN; /* tell caller to check again */ | ||
294 | dprintk("RPC: %5u %s: waiting for another binder\n", | 505 | dprintk("RPC: %5u %s: waiting for another binder\n", |
295 | task->tk_pid, __func__); | 506 | task->tk_pid, __func__); |
296 | goto bailout_nowake; | 507 | return; |
297 | } | 508 | } |
298 | 509 | ||
299 | /* Put self on queue before sending rpcbind request, in case | ||
300 | * rpcb_getport_done completes before we return from rpc_run_task */ | ||
301 | rpc_sleep_on(&xprt->binding, task, NULL); | ||
302 | |||
303 | /* Someone else may have bound if we slept */ | 510 | /* Someone else may have bound if we slept */ |
304 | if (xprt_bound(xprt)) { | 511 | if (xprt_bound(xprt)) { |
305 | status = 0; | 512 | status = 0; |
@@ -338,7 +545,7 @@ void rpcb_getport_async(struct rpc_task *task) | |||
338 | task->tk_pid, __func__, bind_version); | 545 | task->tk_pid, __func__, bind_version); |
339 | 546 | ||
340 | rpcb_clnt = rpcb_create(clnt->cl_server, sap, salen, xprt->prot, | 547 | rpcb_clnt = rpcb_create(clnt->cl_server, sap, salen, xprt->prot, |
341 | bind_version, 0); | 548 | bind_version); |
342 | if (IS_ERR(rpcb_clnt)) { | 549 | if (IS_ERR(rpcb_clnt)) { |
343 | status = PTR_ERR(rpcb_clnt); | 550 | status = PTR_ERR(rpcb_clnt); |
344 | dprintk("RPC: %5u %s: rpcb_create failed, error %ld\n", | 551 | dprintk("RPC: %5u %s: rpcb_create failed, error %ld\n", |
@@ -361,15 +568,15 @@ void rpcb_getport_async(struct rpc_task *task) | |||
361 | map->r_netid = rpc_peeraddr2str(clnt, RPC_DISPLAY_NETID); | 568 | map->r_netid = rpc_peeraddr2str(clnt, RPC_DISPLAY_NETID); |
362 | map->r_addr = rpc_peeraddr2str(rpcb_clnt, RPC_DISPLAY_UNIVERSAL_ADDR); | 569 | map->r_addr = rpc_peeraddr2str(rpcb_clnt, RPC_DISPLAY_UNIVERSAL_ADDR); |
363 | map->r_owner = RPCB_OWNER_STRING; /* ignored for GETADDR */ | 570 | map->r_owner = RPCB_OWNER_STRING; /* ignored for GETADDR */ |
571 | map->r_status = -EIO; | ||
364 | 572 | ||
365 | child = rpcb_call_async(rpcb_clnt, map, proc); | 573 | child = rpcb_call_async(rpcb_clnt, map, proc); |
366 | rpc_release_client(rpcb_clnt); | 574 | rpc_release_client(rpcb_clnt); |
367 | if (IS_ERR(child)) { | 575 | if (IS_ERR(child)) { |
368 | status = -EIO; | ||
369 | /* rpcb_map_release() has freed the arguments */ | 576 | /* rpcb_map_release() has freed the arguments */ |
370 | dprintk("RPC: %5u %s: rpc_run_task failed\n", | 577 | dprintk("RPC: %5u %s: rpc_run_task failed\n", |
371 | task->tk_pid, __func__); | 578 | task->tk_pid, __func__); |
372 | goto bailout_nofree; | 579 | return; |
373 | } | 580 | } |
374 | rpc_put_task(child); | 581 | rpc_put_task(child); |
375 | 582 | ||
@@ -378,7 +585,6 @@ void rpcb_getport_async(struct rpc_task *task) | |||
378 | 585 | ||
379 | bailout_nofree: | 586 | bailout_nofree: |
380 | rpcb_wake_rpcbind_waiters(xprt, status); | 587 | rpcb_wake_rpcbind_waiters(xprt, status); |
381 | bailout_nowake: | ||
382 | task->tk_status = status; | 588 | task->tk_status = status; |
383 | } | 589 | } |
384 | EXPORT_SYMBOL_GPL(rpcb_getport_async); | 590 | EXPORT_SYMBOL_GPL(rpcb_getport_async); |
@@ -417,9 +623,13 @@ static void rpcb_getport_done(struct rpc_task *child, void *data) | |||
417 | dprintk("RPC: %5u rpcb_getport_done(status %d, port %u)\n", | 623 | dprintk("RPC: %5u rpcb_getport_done(status %d, port %u)\n", |
418 | child->tk_pid, status, map->r_port); | 624 | child->tk_pid, status, map->r_port); |
419 | 625 | ||
420 | rpcb_wake_rpcbind_waiters(xprt, status); | 626 | map->r_status = status; |
421 | } | 627 | } |
422 | 628 | ||
629 | /* | ||
630 | * XDR functions for rpcbind | ||
631 | */ | ||
632 | |||
423 | static int rpcb_encode_mapping(struct rpc_rqst *req, __be32 *p, | 633 | static int rpcb_encode_mapping(struct rpc_rqst *req, __be32 *p, |
424 | struct rpcbind_args *rpcb) | 634 | struct rpcbind_args *rpcb) |
425 | { | 635 | { |
@@ -438,7 +648,7 @@ static int rpcb_decode_getport(struct rpc_rqst *req, __be32 *p, | |||
438 | unsigned short *portp) | 648 | unsigned short *portp) |
439 | { | 649 | { |
440 | *portp = (unsigned short) ntohl(*p++); | 650 | *portp = (unsigned short) ntohl(*p++); |
441 | dprintk("RPC: rpcb_decode_getport result %u\n", | 651 | dprintk("RPC: rpcb_decode_getport result %u\n", |
442 | *portp); | 652 | *portp); |
443 | return 0; | 653 | return 0; |
444 | } | 654 | } |
@@ -447,8 +657,8 @@ static int rpcb_decode_set(struct rpc_rqst *req, __be32 *p, | |||
447 | unsigned int *boolp) | 657 | unsigned int *boolp) |
448 | { | 658 | { |
449 | *boolp = (unsigned int) ntohl(*p++); | 659 | *boolp = (unsigned int) ntohl(*p++); |
450 | dprintk("RPC: rpcb_decode_set result %u\n", | 660 | dprintk("RPC: rpcb_decode_set: call %s\n", |
451 | *boolp); | 661 | (*boolp ? "succeeded" : "failed")); |
452 | return 0; | 662 | return 0; |
453 | } | 663 | } |
454 | 664 | ||
@@ -571,52 +781,60 @@ out_err: | |||
571 | static struct rpc_procinfo rpcb_procedures2[] = { | 781 | static struct rpc_procinfo rpcb_procedures2[] = { |
572 | PROC(SET, mapping, set), | 782 | PROC(SET, mapping, set), |
573 | PROC(UNSET, mapping, set), | 783 | PROC(UNSET, mapping, set), |
574 | PROC(GETADDR, mapping, getport), | 784 | PROC(GETPORT, mapping, getport), |
575 | }; | 785 | }; |
576 | 786 | ||
577 | static struct rpc_procinfo rpcb_procedures3[] = { | 787 | static struct rpc_procinfo rpcb_procedures3[] = { |
578 | PROC(SET, mapping, set), | 788 | PROC(SET, getaddr, set), |
579 | PROC(UNSET, mapping, set), | 789 | PROC(UNSET, getaddr, set), |
580 | PROC(GETADDR, getaddr, getaddr), | 790 | PROC(GETADDR, getaddr, getaddr), |
581 | }; | 791 | }; |
582 | 792 | ||
583 | static struct rpc_procinfo rpcb_procedures4[] = { | 793 | static struct rpc_procinfo rpcb_procedures4[] = { |
584 | PROC(SET, mapping, set), | 794 | PROC(SET, getaddr, set), |
585 | PROC(UNSET, mapping, set), | 795 | PROC(UNSET, getaddr, set), |
796 | PROC(GETADDR, getaddr, getaddr), | ||
586 | PROC(GETVERSADDR, getaddr, getaddr), | 797 | PROC(GETVERSADDR, getaddr, getaddr), |
587 | }; | 798 | }; |
588 | 799 | ||
589 | static struct rpcb_info rpcb_next_version[] = { | 800 | static struct rpcb_info rpcb_next_version[] = { |
590 | #ifdef CONFIG_SUNRPC_BIND34 | 801 | { |
591 | { 4, &rpcb_procedures4[RPCBPROC_GETVERSADDR] }, | 802 | .rpc_vers = RPCBVERS_2, |
592 | { 3, &rpcb_procedures3[RPCBPROC_GETADDR] }, | 803 | .rpc_proc = &rpcb_procedures2[RPCBPROC_GETPORT], |
593 | #endif | 804 | }, |
594 | { 2, &rpcb_procedures2[RPCBPROC_GETPORT] }, | 805 | { |
595 | { 0, NULL }, | 806 | .rpc_proc = NULL, |
807 | }, | ||
596 | }; | 808 | }; |
597 | 809 | ||
598 | static struct rpcb_info rpcb_next_version6[] = { | 810 | static struct rpcb_info rpcb_next_version6[] = { |
599 | #ifdef CONFIG_SUNRPC_BIND34 | 811 | { |
600 | { 4, &rpcb_procedures4[RPCBPROC_GETVERSADDR] }, | 812 | .rpc_vers = RPCBVERS_4, |
601 | { 3, &rpcb_procedures3[RPCBPROC_GETADDR] }, | 813 | .rpc_proc = &rpcb_procedures4[RPCBPROC_GETADDR], |
602 | #endif | 814 | }, |
603 | { 0, NULL }, | 815 | { |
816 | .rpc_vers = RPCBVERS_3, | ||
817 | .rpc_proc = &rpcb_procedures3[RPCBPROC_GETADDR], | ||
818 | }, | ||
819 | { | ||
820 | .rpc_proc = NULL, | ||
821 | }, | ||
604 | }; | 822 | }; |
605 | 823 | ||
606 | static struct rpc_version rpcb_version2 = { | 824 | static struct rpc_version rpcb_version2 = { |
607 | .number = 2, | 825 | .number = RPCBVERS_2, |
608 | .nrprocs = RPCB_HIGHPROC_2, | 826 | .nrprocs = RPCB_HIGHPROC_2, |
609 | .procs = rpcb_procedures2 | 827 | .procs = rpcb_procedures2 |
610 | }; | 828 | }; |
611 | 829 | ||
612 | static struct rpc_version rpcb_version3 = { | 830 | static struct rpc_version rpcb_version3 = { |
613 | .number = 3, | 831 | .number = RPCBVERS_3, |
614 | .nrprocs = RPCB_HIGHPROC_3, | 832 | .nrprocs = RPCB_HIGHPROC_3, |
615 | .procs = rpcb_procedures3 | 833 | .procs = rpcb_procedures3 |
616 | }; | 834 | }; |
617 | 835 | ||
618 | static struct rpc_version rpcb_version4 = { | 836 | static struct rpc_version rpcb_version4 = { |
619 | .number = 4, | 837 | .number = RPCBVERS_4, |
620 | .nrprocs = RPCB_HIGHPROC_4, | 838 | .nrprocs = RPCB_HIGHPROC_4, |
621 | .procs = rpcb_procedures4 | 839 | .procs = rpcb_procedures4 |
622 | }; | 840 | }; |
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 6eab9bf94baf..6288af05c20f 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -626,19 +626,15 @@ static void __rpc_execute(struct rpc_task *task) | |||
626 | /* | 626 | /* |
627 | * Execute any pending callback. | 627 | * Execute any pending callback. |
628 | */ | 628 | */ |
629 | if (RPC_DO_CALLBACK(task)) { | 629 | if (task->tk_callback) { |
630 | /* Define a callback save pointer */ | ||
631 | void (*save_callback)(struct rpc_task *); | 630 | void (*save_callback)(struct rpc_task *); |
632 | 631 | ||
633 | /* | 632 | /* |
634 | * If a callback exists, save it, reset it, | 633 | * We set tk_callback to NULL before calling it, |
635 | * call it. | 634 | * in case it sets the tk_callback field itself: |
636 | * The save is needed to stop from resetting | ||
637 | * another callback set within the callback handler | ||
638 | * - Dave | ||
639 | */ | 635 | */ |
640 | save_callback=task->tk_callback; | 636 | save_callback = task->tk_callback; |
641 | task->tk_callback=NULL; | 637 | task->tk_callback = NULL; |
642 | save_callback(task); | 638 | save_callback(task); |
643 | } | 639 | } |
644 | 640 | ||
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index e1770f7ba0b3..99a52aabe332 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -690,7 +690,7 @@ static void xprt_connect_status(struct rpc_task *task) | |||
690 | { | 690 | { |
691 | struct rpc_xprt *xprt = task->tk_xprt; | 691 | struct rpc_xprt *xprt = task->tk_xprt; |
692 | 692 | ||
693 | if (task->tk_status >= 0) { | 693 | if (task->tk_status == 0) { |
694 | xprt->stat.connect_count++; | 694 | xprt->stat.connect_count++; |
695 | xprt->stat.connect_time += (long)jiffies - xprt->stat.connect_start; | 695 | xprt->stat.connect_time += (long)jiffies - xprt->stat.connect_start; |
696 | dprintk("RPC: %5u xprt_connect_status: connection established\n", | 696 | dprintk("RPC: %5u xprt_connect_status: connection established\n", |
@@ -699,12 +699,6 @@ static void xprt_connect_status(struct rpc_task *task) | |||
699 | } | 699 | } |
700 | 700 | ||
701 | switch (task->tk_status) { | 701 | switch (task->tk_status) { |
702 | case -ECONNREFUSED: | ||
703 | case -ECONNRESET: | ||
704 | dprintk("RPC: %5u xprt_connect_status: server %s refused " | ||
705 | "connection\n", task->tk_pid, | ||
706 | task->tk_client->cl_server); | ||
707 | break; | ||
708 | case -ENOTCONN: | 702 | case -ENOTCONN: |
709 | dprintk("RPC: %5u xprt_connect_status: connection broken\n", | 703 | dprintk("RPC: %5u xprt_connect_status: connection broken\n", |
710 | task->tk_pid); | 704 | task->tk_pid); |
@@ -878,6 +872,7 @@ void xprt_transmit(struct rpc_task *task) | |||
878 | return; | 872 | return; |
879 | 873 | ||
880 | req->rq_connect_cookie = xprt->connect_cookie; | 874 | req->rq_connect_cookie = xprt->connect_cookie; |
875 | req->rq_xtime = jiffies; | ||
881 | status = xprt->ops->send_request(task); | 876 | status = xprt->ops->send_request(task); |
882 | if (status == 0) { | 877 | if (status == 0) { |
883 | dprintk("RPC: %5u xmit complete\n", task->tk_pid); | 878 | dprintk("RPC: %5u xmit complete\n", task->tk_pid); |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index ddbe981ab516..4486c59c3aca 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -579,7 +579,6 @@ static int xs_udp_send_request(struct rpc_task *task) | |||
579 | req->rq_svec->iov_base, | 579 | req->rq_svec->iov_base, |
580 | req->rq_svec->iov_len); | 580 | req->rq_svec->iov_len); |
581 | 581 | ||
582 | req->rq_xtime = jiffies; | ||
583 | status = xs_sendpages(transport->sock, | 582 | status = xs_sendpages(transport->sock, |
584 | xs_addr(xprt), | 583 | xs_addr(xprt), |
585 | xprt->addrlen, xdr, | 584 | xprt->addrlen, xdr, |
@@ -671,7 +670,6 @@ static int xs_tcp_send_request(struct rpc_task *task) | |||
671 | * to cope with writespace callbacks arriving _after_ we have | 670 | * to cope with writespace callbacks arriving _after_ we have |
672 | * called sendmsg(). */ | 671 | * called sendmsg(). */ |
673 | while (1) { | 672 | while (1) { |
674 | req->rq_xtime = jiffies; | ||
675 | status = xs_sendpages(transport->sock, | 673 | status = xs_sendpages(transport->sock, |
676 | NULL, 0, xdr, req->rq_bytes_sent); | 674 | NULL, 0, xdr, req->rq_bytes_sent); |
677 | 675 | ||