Lines Matching refs:task
46 static void call_start(struct rpc_task *task);
47 static void call_reserve(struct rpc_task *task);
48 static void call_reserveresult(struct rpc_task *task);
49 static void call_allocate(struct rpc_task *task);
50 static void call_encode(struct rpc_task *task);
51 static void call_decode(struct rpc_task *task);
52 static void call_bind(struct rpc_task *task);
53 static void call_transmit(struct rpc_task *task);
54 static void call_status(struct rpc_task *task);
55 static void call_refresh(struct rpc_task *task);
56 static void call_refreshresult(struct rpc_task *task);
57 static void call_timeout(struct rpc_task *task);
58 static void call_connect(struct rpc_task *task);
60 static u32 * call_header(struct rpc_task *task);
61 static u32 * call_verify(struct rpc_task *task);
197 rpc_default_callback(struct rpc_task *task) in rpc_default_callback() argument
241 struct rpc_task my_task, *task = &my_task; in rpc_call_sync() local
257 rpc_init_task(task, clnt, NULL, flags); in rpc_call_sync()
258 rpc_call_setup(task, msg, 0); in rpc_call_sync()
261 if (task->tk_status == 0) in rpc_call_sync()
262 status = rpc_execute(task); in rpc_call_sync()
264 status = task->tk_status; in rpc_call_sync()
265 rpc_release_task(task); in rpc_call_sync()
280 struct rpc_task *task; in rpc_call_async() local
296 if (!(task = rpc_new_task(clnt, callback, flags))) in rpc_call_async()
298 task->tk_calldata = data; in rpc_call_async()
300 rpc_call_setup(task, msg, 0); in rpc_call_async()
303 if (task->tk_status == 0) in rpc_call_async()
304 status = rpc_execute(task); in rpc_call_async()
306 status = task->tk_status; in rpc_call_async()
307 rpc_release_task(task); in rpc_call_async()
318 rpc_call_setup(struct rpc_task *task, struct rpc_message *msg, int flags) in rpc_call_setup() argument
320 task->tk_msg = *msg; in rpc_call_setup()
321 task->tk_flags |= flags; in rpc_call_setup()
323 if (task->tk_msg.rpc_cred != NULL) { in rpc_call_setup()
324 rpcauth_holdcred(task); in rpc_call_setup()
326 rpcauth_bindcred(task); in rpc_call_setup()
328 if (task->tk_status == 0) in rpc_call_setup()
329 task->tk_action = call_start; in rpc_call_setup()
331 task->tk_action = NULL; in rpc_call_setup()
353 rpc_restart_call(struct rpc_task *task) in rpc_restart_call() argument
355 if (RPC_ASSASSINATED(task)) in rpc_restart_call()
358 task->tk_action = call_start; in rpc_restart_call()
368 call_start(struct rpc_task *task) in call_start() argument
370 struct rpc_clnt *clnt = task->tk_client; in call_start()
372 if (task->tk_msg.rpc_proc > clnt->cl_maxproc) { in call_start()
375 task->tk_msg.rpc_proc); in call_start()
376 rpc_exit(task, -EIO); in call_start()
380 dprintk("RPC: %4d call_start %s%d proc %d (%s)\n", task->tk_pid, in call_start()
381 clnt->cl_protname, clnt->cl_vers, task->tk_msg.rpc_proc, in call_start()
382 (RPC_IS_ASYNC(task) ? "async" : "sync")); in call_start()
385 rpcproc_count(clnt, task->tk_msg.rpc_proc)++; in call_start()
387 task->tk_action = call_reserve; in call_start()
394 call_reserve(struct rpc_task *task) in call_reserve() argument
396 dprintk("RPC: %4d call_reserve\n", task->tk_pid); in call_reserve()
398 if (!rpcauth_uptodatecred(task)) { in call_reserve()
399 task->tk_action = call_refresh; in call_reserve()
403 task->tk_status = 0; in call_reserve()
404 task->tk_action = call_reserveresult; in call_reserve()
405 xprt_reserve(task); in call_reserve()
412 call_reserveresult(struct rpc_task *task) in call_reserveresult() argument
414 int status = task->tk_status; in call_reserveresult()
417 task->tk_pid, task->tk_status); in call_reserveresult()
423 task->tk_status = 0; in call_reserveresult()
425 if (task->tk_rqstp) { in call_reserveresult()
426 task->tk_action = call_allocate; in call_reserveresult()
432 rpc_exit(task, -EIO); in call_reserveresult()
440 if (task->tk_rqstp) { in call_reserveresult()
443 xprt_release(task); in call_reserveresult()
448 task->tk_action = call_reserve; in call_reserveresult()
457 rpc_exit(task, status); in call_reserveresult()
465 call_allocate(struct rpc_task *task) in call_allocate() argument
467 struct rpc_clnt *clnt = task->tk_client; in call_allocate()
471 task->tk_pid, task->tk_status); in call_allocate()
472 task->tk_action = call_encode; in call_allocate()
473 if (task->tk_buffer) in call_allocate()
478 bufsiz = rpcproc_bufsiz(clnt, task->tk_msg.rpc_proc) + RPC_SLACK_SPACE; in call_allocate()
480 if ((task->tk_buffer = rpc_malloc(task, bufsiz << 1)) != NULL) in call_allocate()
482 printk(KERN_INFO "RPC: buffer allocation failed for task %p\n", task); in call_allocate()
484 if (RPC_IS_ASYNC(task) || !(task->tk_client->cl_intr && signalled())) { in call_allocate()
485 xprt_release(task); in call_allocate()
486 task->tk_action = call_reserve; in call_allocate()
487 rpc_delay(task, HZ>>4); in call_allocate()
491 rpc_exit(task, -ERESTARTSYS); in call_allocate()
498 call_encode(struct rpc_task *task) in call_encode() argument
500 struct rpc_clnt *clnt = task->tk_client; in call_encode()
501 struct rpc_rqst *req = task->tk_rqstp; in call_encode()
510 task->tk_pid, task->tk_status); in call_encode()
512 task->tk_action = call_bind; in call_encode()
515 bufsiz = rpcproc_bufsiz(clnt, task->tk_msg.rpc_proc)+RPC_SLACK_SPACE; in call_encode()
516 sndbuf->head[0].iov_base = (void *)task->tk_buffer; in call_encode()
521 rcvbuf->head[0].iov_base = (void *)((char *)task->tk_buffer + bufsiz); in call_encode()
528 memset(task->tk_buffer, 0, bufsiz); in call_encode()
531 encode = rpcproc_encode(clnt, task->tk_msg.rpc_proc); in call_encode()
532 if (!(p = call_header(task))) { in call_encode()
534 rpc_exit(task, -EIO); in call_encode()
536 if (encode && (status = encode(req, p, task->tk_msg.rpc_argp)) < 0) { in call_encode()
539 rpc_exit(task, status); in call_encode()
547 call_bind(struct rpc_task *task) in call_bind() argument
549 struct rpc_clnt *clnt = task->tk_client; in call_bind()
552 dprintk("RPC: %4d call_bind xprt %p %s connected\n", task->tk_pid, in call_bind()
555 task->tk_action = (xprt_connected(xprt)) ? call_transmit : call_connect; in call_bind()
558 task->tk_action = call_connect; in call_bind()
559 task->tk_timeout = clnt->cl_timeout.to_maxval; in call_bind()
560 rpc_getport(task, clnt); in call_bind()
569 call_connect(struct rpc_task *task) in call_connect() argument
571 struct rpc_clnt *clnt = task->tk_client; in call_connect()
574 task->tk_pid, task->tk_status); in call_connect()
577 task->tk_action = call_transmit; in call_connect()
580 task->tk_action = call_connect_status; in call_connect()
581 if (task->tk_status < 0) in call_connect()
583 xprt_connect(task); in call_connect()
589 static void call_connect_status(struct rpc_task *task) in call_connect_status() argument
591 struct rpc_clnt *clnt = task->tk_client; in call_connect_status()
592 int status = task->tk_status; in call_connect_status()
594 task->tk_status = 0; in call_connect_status()
597 task->tk_action = call_transmit; in call_connect_status()
610 task->tk_action = (clnt->cl_port == 0) ? call_bind : call_connect; in call_connect_status()
613 rpc_exit(task, status); in call_connect_status()
621 call_transmit(struct rpc_task *task) in call_transmit() argument
623 struct rpc_clnt *clnt = task->tk_client; in call_transmit()
626 task->tk_pid, task->tk_status); in call_transmit()
628 task->tk_action = call_status; in call_transmit()
629 if (task->tk_status < 0) in call_transmit()
631 xprt_transmit(task); in call_transmit()
632 if (!rpcproc_decode(clnt, task->tk_msg.rpc_proc) && task->tk_status >= 0) { in call_transmit()
633 task->tk_action = NULL; in call_transmit()
634 rpc_wake_up_task(task); in call_transmit()
642 call_status(struct rpc_task *task) in call_status() argument
644 struct rpc_clnt *clnt = task->tk_client; in call_status()
646 struct rpc_rqst *req = task->tk_rqstp; in call_status()
651 task->tk_status = req->rq_received; in call_status()
654 task->tk_pid, task->tk_status); in call_status()
656 status = task->tk_status; in call_status()
658 task->tk_action = call_decode; in call_status()
662 task->tk_status = 0; in call_status()
665 task->tk_action = call_timeout; in call_status()
672 task->tk_action = call_bind; in call_status()
675 task->tk_action = call_connect; in call_status()
680 task->tk_timeout = 5 * HZ; in call_status()
681 rpc_sleep_on(&xprt->sending, task, NULL, NULL); in call_status()
684 task->tk_action = call_transmit; in call_status()
690 rpc_exit(task, status); in call_status()
700 call_timeout(struct rpc_task *task) in call_timeout() argument
702 struct rpc_clnt *clnt = task->tk_client; in call_timeout()
703 struct rpc_timeout *to = &task->tk_rqstp->rq_timeout; in call_timeout()
706 dprintk("RPC: %4d call_timeout (minor)\n", task->tk_pid); in call_timeout()
711 dprintk("RPC: %4d call_timeout (major)\n", task->tk_pid); in call_timeout()
716 rpc_exit(task, -EIO); in call_timeout()
720 if (clnt->cl_chatty && !(task->tk_flags & RPC_CALL_MAJORSEEN)) { in call_timeout()
721 task->tk_flags |= RPC_CALL_MAJORSEEN; in call_timeout()
730 task->tk_action = call_bind; in call_timeout()
731 task->tk_status = 0; in call_timeout()
738 call_decode(struct rpc_task *task) in call_decode() argument
740 struct rpc_clnt *clnt = task->tk_client; in call_decode()
741 struct rpc_rqst *req = task->tk_rqstp; in call_decode()
742 kxdrproc_t decode = rpcproc_decode(clnt, task->tk_msg.rpc_proc); in call_decode()
746 task->tk_pid, task->tk_status); in call_decode()
748 if (clnt->cl_chatty && (task->tk_flags & RPC_CALL_MAJORSEEN)) { in call_decode()
751 task->tk_flags &= ~RPC_CALL_MAJORSEEN; in call_decode()
754 if (task->tk_status < 12) { in call_decode()
756 task->tk_action = call_transmit; in call_decode()
761 clnt->cl_protname, task->tk_status); in call_decode()
762 rpc_exit(task, -EIO); in call_decode()
773 if (!(p = call_verify(task))) { in call_decode()
779 if (task->tk_action == NULL) in call_decode()
787 if (task->tk_client->cl_droppriv && in call_decode()
789 if (RPC_IS_SETUID(task) && task->tk_suid_retry) { in call_decode()
790 dprintk("RPC: %4d retry squashed uid\n", task->tk_pid); in call_decode()
791 task->tk_flags ^= RPC_CALL_REALUID; in call_decode()
792 task->tk_action = call_encode; in call_decode()
793 task->tk_suid_retry--; in call_decode()
798 task->tk_action = NULL; in call_decode()
801 task->tk_status = decode(req, p, task->tk_msg.rpc_resp); in call_decode()
802 dprintk("RPC: %4d call_decode result %d\n", task->tk_pid, in call_decode()
803 task->tk_status); in call_decode()
807 task->tk_status = 0; in call_decode()
814 call_refresh(struct rpc_task *task) in call_refresh() argument
816 dprintk("RPC: %4d call_refresh\n", task->tk_pid); in call_refresh()
818 xprt_release(task); /* Must do to obtain new XID */ in call_refresh()
819 task->tk_action = call_refreshresult; in call_refresh()
820 task->tk_status = 0; in call_refresh()
821 task->tk_client->cl_stats->rpcauthrefresh++; in call_refresh()
822 rpcauth_refreshcred(task); in call_refresh()
829 call_refreshresult(struct rpc_task *task) in call_refreshresult() argument
832 task->tk_pid, task->tk_status); in call_refreshresult()
834 if (task->tk_status < 0) in call_refreshresult()
835 rpc_exit(task, -EACCES); in call_refreshresult()
837 task->tk_action = call_reserve; in call_refreshresult()
844 call_header(struct rpc_task *task) in call_header() argument
846 struct rpc_clnt *clnt = task->tk_client; in call_header()
848 struct rpc_rqst *req = task->tk_rqstp; in call_header()
859 *p++ = htonl(task->tk_msg.rpc_proc); /* procedure */ in call_header()
860 return rpcauth_marshcred(task, p); in call_header()
867 call_verify(struct rpc_task *task) in call_verify() argument
869 u32 *p = task->tk_rqstp->rq_rvec[0].iov_base, n; in call_verify()
886 if (!task->tk_cred_retry) in call_verify()
888 task->tk_cred_retry--; in call_verify()
890 task->tk_pid); in call_verify()
891 rpcauth_invalcred(task); in call_verify()
892 task->tk_action = call_refresh; in call_verify()
897 if (!task->tk_garb_retry) in call_verify()
899 task->tk_garb_retry--; in call_verify()
901 task->tk_pid); in call_verify()
902 task->tk_action = call_encode; in call_verify()
913 task->tk_pid, n); in call_verify()
914 rpc_exit(task, error); in call_verify()
917 if (!(p = rpcauth_checkverf(task, p))) { in call_verify()
926 (unsigned int)task->tk_client->cl_prog, in call_verify()
927 task->tk_client->cl_server); in call_verify()
931 (unsigned int)task->tk_client->cl_prog, in call_verify()
932 (unsigned int)task->tk_client->cl_vers, in call_verify()
933 task->tk_client->cl_server); in call_verify()
937 (unsigned int)task->tk_msg.rpc_proc, in call_verify()
938 (unsigned int)task->tk_client->cl_prog, in call_verify()
939 (unsigned int)task->tk_client->cl_vers, in call_verify()
940 task->tk_client->cl_server); in call_verify()
950 dprintk("RPC: %4d call_verify: server saw garbage\n", task->tk_pid); in call_verify()
951 task->tk_client->cl_stats->rpcgarbage++; in call_verify()
952 if (task->tk_garb_retry) { in call_verify()
953 task->tk_garb_retry--; in call_verify()
954 dprintk(KERN_WARNING "RPC: garbage, retrying %4d\n", task->tk_pid); in call_verify()
955 task->tk_action = call_encode; in call_verify()
960 rpc_exit(task, -EIO); in call_verify()