Lines Matching refs:task

36 static void			__rpc_default_timer(struct rpc_task *task);
106 __rpc_disable_timer(struct rpc_task *task) in __rpc_disable_timer() argument
108 dprintk("RPC: %4d disabling timer\n", task->tk_pid); in __rpc_disable_timer()
109 task->tk_timeout_fn = NULL; in __rpc_disable_timer()
110 task->tk_timeout = 0; in __rpc_disable_timer()
121 rpc_run_timer(struct rpc_task *task) in rpc_run_timer() argument
126 callback = task->tk_timeout_fn; in rpc_run_timer()
127 task->tk_timeout_fn = NULL; in rpc_run_timer()
130 dprintk("RPC: %4d running timer\n", task->tk_pid); in rpc_run_timer()
131 callback(task); in rpc_run_timer()
139 __rpc_add_timer(struct rpc_task *task, rpc_action timer) in __rpc_add_timer() argument
141 if (!task->tk_timeout) in __rpc_add_timer()
145 task->tk_pid, task->tk_timeout * 1000 / HZ); in __rpc_add_timer()
148 task->tk_timeout_fn = timer; in __rpc_add_timer()
150 task->tk_timeout_fn = __rpc_default_timer; in __rpc_add_timer()
151 mod_timer(&task->tk_timer, jiffies + task->tk_timeout); in __rpc_add_timer()
157 void rpc_add_timer(struct rpc_task *task, rpc_action timer) in rpc_add_timer() argument
160 if (!RPC_IS_RUNNING(task)) in rpc_add_timer()
161 __rpc_add_timer(task, timer); in rpc_add_timer()
170 rpc_delete_timer(struct rpc_task *task) in rpc_delete_timer() argument
172 dprintk("RPC: %4d deleting timer\n", task->tk_pid); in rpc_delete_timer()
173 del_timer_sync(&task->tk_timer); in rpc_delete_timer()
185 __rpc_add_wait_queue(struct rpc_wait_queue *queue, struct rpc_task *task) in __rpc_add_wait_queue() argument
187 if (task->tk_rpcwait == queue) in __rpc_add_wait_queue()
190 if (task->tk_rpcwait) { in __rpc_add_wait_queue()
194 if (RPC_IS_SWAPPER(task)) in __rpc_add_wait_queue()
195 list_add(&task->tk_list, &queue->tasks); in __rpc_add_wait_queue()
197 list_add_tail(&task->tk_list, &queue->tasks); in __rpc_add_wait_queue()
198 task->tk_rpcwait = queue; in __rpc_add_wait_queue()
201 task->tk_pid, queue, rpc_qname(queue)); in __rpc_add_wait_queue()
207 rpc_add_wait_queue(struct rpc_wait_queue *q, struct rpc_task *task) in rpc_add_wait_queue() argument
212 result = __rpc_add_wait_queue(q, task); in rpc_add_wait_queue()
222 __rpc_remove_wait_queue(struct rpc_task *task) in __rpc_remove_wait_queue() argument
224 struct rpc_wait_queue *queue = task->tk_rpcwait; in __rpc_remove_wait_queue()
229 list_del(&task->tk_list); in __rpc_remove_wait_queue()
230 task->tk_rpcwait = NULL; in __rpc_remove_wait_queue()
233 task->tk_pid, queue, rpc_qname(queue)); in __rpc_remove_wait_queue()
237 rpc_remove_wait_queue(struct rpc_task *task) in rpc_remove_wait_queue() argument
239 if (!task->tk_rpcwait) in rpc_remove_wait_queue()
242 __rpc_remove_wait_queue(task); in rpc_remove_wait_queue()
253 rpc_make_runnable(struct rpc_task *task) in rpc_make_runnable() argument
255 if (task->tk_timeout_fn) { in rpc_make_runnable()
259 rpc_set_running(task); in rpc_make_runnable()
260 if (RPC_IS_ASYNC(task)) { in rpc_make_runnable()
261 if (RPC_IS_SLEEPING(task)) { in rpc_make_runnable()
263 status = __rpc_add_wait_queue(&schedq, task); in rpc_make_runnable()
266 task->tk_status = status; in rpc_make_runnable()
269 rpc_clear_sleeping(task); in rpc_make_runnable()
274 rpc_clear_sleeping(task); in rpc_make_runnable()
275 if (waitqueue_active(&task->tk_wait)) in rpc_make_runnable()
276 wake_up(&task->tk_wait); in rpc_make_runnable()
284 rpc_schedule_run(struct rpc_task *task) in rpc_schedule_run() argument
287 if (RPC_IS_ACTIVATED(task)) in rpc_schedule_run()
289 task->tk_active = 1; in rpc_schedule_run()
290 rpc_set_sleeping(task); in rpc_schedule_run()
291 rpc_make_runnable(task); in rpc_schedule_run()
313 __rpc_sleep_on(struct rpc_wait_queue *q, struct rpc_task *task, in __rpc_sleep_on() argument
318 dprintk("RPC: %4d sleep_on(queue \"%s\" time %ld)\n", task->tk_pid, in __rpc_sleep_on()
321 if (!RPC_IS_ASYNC(task) && !RPC_IS_ACTIVATED(task)) { in __rpc_sleep_on()
327 if (!RPC_IS_ACTIVATED(task)) { in __rpc_sleep_on()
328 task->tk_active = 1; in __rpc_sleep_on()
329 rpc_set_sleeping(task); in __rpc_sleep_on()
332 status = __rpc_add_wait_queue(q, task); in __rpc_sleep_on()
335 task->tk_status = status; in __rpc_sleep_on()
337 rpc_clear_running(task); in __rpc_sleep_on()
338 if (task->tk_callback) { in __rpc_sleep_on()
339 dprintk(KERN_ERR "RPC: %4d overwrites an active callback\n", task->tk_pid); in __rpc_sleep_on()
342 task->tk_callback = action; in __rpc_sleep_on()
343 __rpc_add_timer(task, timer); in __rpc_sleep_on()
348 rpc_sleep_on(struct rpc_wait_queue *q, struct rpc_task *task, in rpc_sleep_on() argument
355 __rpc_sleep_on(q, task, action, timer); in rpc_sleep_on()
366 __rpc_wake_up_task(struct rpc_task *task) in __rpc_wake_up_task() argument
369 task->tk_pid, jiffies, rpc_inhibit); in __rpc_wake_up_task()
372 if (task->tk_magic != 0xf00baa) { in __rpc_wake_up_task()
380 if (!RPC_IS_ACTIVATED(task)) { in __rpc_wake_up_task()
381 printk(KERN_ERR "RPC: Inactive task (%p) being woken up!\n", task); in __rpc_wake_up_task()
384 if (RPC_IS_RUNNING(task)) in __rpc_wake_up_task()
387 __rpc_disable_timer(task); in __rpc_wake_up_task()
388 if (task->tk_rpcwait != &schedq) in __rpc_wake_up_task()
389 __rpc_remove_wait_queue(task); in __rpc_wake_up_task()
391 rpc_make_runnable(task); in __rpc_wake_up_task()
400 __rpc_default_timer(struct rpc_task *task) in __rpc_default_timer() argument
402 dprintk("RPC: %d timeout (default timer)\n", task->tk_pid); in __rpc_default_timer()
403 task->tk_status = -ETIMEDOUT; in __rpc_default_timer()
404 rpc_wake_up_task(task); in __rpc_default_timer()
411 rpc_wake_up_task(struct rpc_task *task) in rpc_wake_up_task() argument
413 if (RPC_IS_RUNNING(task)) in rpc_wake_up_task()
416 __rpc_wake_up_task(task); in rpc_wake_up_task()
426 struct rpc_task *task = NULL; in rpc_wake_up_next() local
430 task_for_first(task, &queue->tasks) in rpc_wake_up_next()
431 __rpc_wake_up_task(task); in rpc_wake_up_next()
434 return task; in rpc_wake_up_next()
446 struct rpc_task *task; in rpc_wake_up() local
450 task_for_first(task, &queue->tasks) in rpc_wake_up()
451 __rpc_wake_up_task(task); in rpc_wake_up()
465 struct rpc_task *task; in rpc_wake_up_status() local
469 task_for_first(task, &queue->tasks) { in rpc_wake_up_status()
470 task->tk_status = status; in rpc_wake_up_status()
471 __rpc_wake_up_task(task); in rpc_wake_up_status()
482 rpc_delay(struct rpc_task *task, unsigned long delay) in rpc_delay() argument
484 task->tk_timeout = delay; in rpc_delay()
485 rpc_sleep_on(&delay_queue, task, NULL, __rpc_atrun); in rpc_delay()
489 __rpc_atrun(struct rpc_task *task) in __rpc_atrun() argument
491 task->tk_status = 0; in __rpc_atrun()
492 rpc_wake_up_task(task); in __rpc_atrun()
499 __rpc_execute(struct rpc_task *task) in __rpc_execute() argument
504 task->tk_pid, task->tk_flags); in __rpc_execute()
506 if (!RPC_IS_RUNNING(task)) { in __rpc_execute()
516 if (RPC_DO_CALLBACK(task)) { in __rpc_execute()
527 save_callback=task->tk_callback; in __rpc_execute()
528 task->tk_callback=NULL; in __rpc_execute()
529 save_callback(task); in __rpc_execute()
537 if (RPC_IS_RUNNING(task)) { in __rpc_execute()
541 rpc_delete_timer(task); in __rpc_execute()
542 if (!task->tk_action) in __rpc_execute()
544 task->tk_action(task); in __rpc_execute()
551 if (!RPC_IS_RUNNING(task)) { in __rpc_execute()
552 rpc_set_sleeping(task); in __rpc_execute()
553 if (RPC_IS_ASYNC(task)) { in __rpc_execute()
560 while (RPC_IS_SLEEPING(task)) { in __rpc_execute()
563 task->tk_pid); in __rpc_execute()
567 __wait_event(task->tk_wait, !RPC_IS_SLEEPING(task)); in __rpc_execute()
568 dprintk("RPC: %4d sync task resuming\n", task->tk_pid); in __rpc_execute()
576 if (task->tk_client->cl_intr && signalled()) { in __rpc_execute()
577 dprintk("RPC: %4d got signal\n", task->tk_pid); in __rpc_execute()
578 task->tk_flags |= RPC_TASK_KILLED; in __rpc_execute()
579 rpc_exit(task, -ERESTARTSYS); in __rpc_execute()
580 rpc_wake_up_task(task); in __rpc_execute()
585 if (task->tk_exit) { in __rpc_execute()
586 task->tk_exit(task); in __rpc_execute()
588 if (task->tk_action) { in __rpc_execute()
589 if (!RPC_ASSASSINATED(task)) { in __rpc_execute()
591 if (task->tk_rqstp) in __rpc_execute()
592 xprt_release(task); in __rpc_execute()
593 if (task->tk_buffer) { in __rpc_execute()
594 rpc_free(task->tk_buffer); in __rpc_execute()
595 task->tk_buffer = NULL; in __rpc_execute()
603 dprintk("RPC: %4d exit() = %d\n", task->tk_pid, task->tk_status); in __rpc_execute()
604 status = task->tk_status; in __rpc_execute()
607 rpc_release_task(task); in __rpc_execute()
622 rpc_execute(struct rpc_task *task) in rpc_execute() argument
631 if (task->tk_active) { in rpc_execute()
636 task->tk_active = 1; in rpc_execute()
637 rpc_set_running(task); in rpc_execute()
638 return __rpc_execute(task); in rpc_execute()
640 rpc_release_task(task); in rpc_execute()
651 struct rpc_task *task; in __rpc_schedule() local
658 task_for_first(task, &schedq.tasks) { in __rpc_schedule()
659 __rpc_remove_wait_queue(task); in __rpc_schedule()
662 __rpc_execute(task); in __rpc_schedule()
740 rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, in rpc_init_task() argument
743 memset(task, 0, sizeof(*task)); in rpc_init_task()
744 init_timer(&task->tk_timer); in rpc_init_task()
745 task->tk_timer.data = (unsigned long) task; in rpc_init_task()
746 task->tk_timer.function = (void (*)(unsigned long)) rpc_run_timer; in rpc_init_task()
747 task->tk_client = clnt; in rpc_init_task()
748 task->tk_flags = flags; in rpc_init_task()
749 task->tk_exit = callback; in rpc_init_task()
750 init_waitqueue_head(&task->tk_wait); in rpc_init_task()
752 task->tk_flags |= RPC_TASK_SETUID; in rpc_init_task()
755 task->tk_garb_retry = 2; in rpc_init_task()
756 task->tk_cred_retry = 2; in rpc_init_task()
757 task->tk_suid_retry = 1; in rpc_init_task()
761 list_add(&task->tk_task, &all_tasks); in rpc_init_task()
768 task->tk_magic = 0xf00baa; in rpc_init_task()
769 task->tk_pid = rpc_task_id++; in rpc_init_task()
771 dprintk("RPC: %4d new task procpid %d\n", task->tk_pid, in rpc_init_task()
776 rpc_default_free_task(struct rpc_task *task) in rpc_default_free_task() argument
778 dprintk("RPC: %4d freeing task\n", task->tk_pid); in rpc_default_free_task()
779 rpc_free(task); in rpc_default_free_task()
790 struct rpc_task *task; in rpc_new_task() local
792 task = (struct rpc_task *) rpc_allocate(flags, sizeof(*task)); in rpc_new_task()
793 if (!task) in rpc_new_task()
796 rpc_init_task(task, clnt, callback, flags); in rpc_new_task()
799 task->tk_release = rpc_default_free_task; in rpc_new_task()
801 dprintk("RPC: %4d allocated task\n", task->tk_pid); in rpc_new_task()
802 task->tk_flags |= RPC_TASK_DYNAMIC; in rpc_new_task()
804 return task; in rpc_new_task()
818 rpc_release_task(struct rpc_task *task) in rpc_release_task() argument
820 dprintk("RPC: %4d release task\n", task->tk_pid); in rpc_release_task()
823 if (task->tk_magic != 0xf00baa) { in rpc_release_task()
833 list_del(&task->tk_task); in rpc_release_task()
840 __rpc_disable_timer(task); in rpc_release_task()
843 __rpc_remove_wait_queue(task); in rpc_release_task()
845 task->tk_active = 0; in rpc_release_task()
850 rpc_delete_timer(task); in rpc_release_task()
853 if (task->tk_rqstp) in rpc_release_task()
854 xprt_release(task); in rpc_release_task()
855 if (task->tk_msg.rpc_cred) in rpc_release_task()
856 rpcauth_unbindcred(task); in rpc_release_task()
857 if (task->tk_buffer) { in rpc_release_task()
858 rpc_free(task->tk_buffer); in rpc_release_task()
859 task->tk_buffer = NULL; in rpc_release_task()
861 if (task->tk_client) { in rpc_release_task()
862 rpc_release_client(task->tk_client); in rpc_release_task()
863 task->tk_client = NULL; in rpc_release_task()
867 task->tk_magic = 0; in rpc_release_task()
869 if (task->tk_release) in rpc_release_task()
870 task->tk_release(task); in rpc_release_task()
886 struct rpc_task *task, *parent; in rpc_find_parent() local
890 task_for_each(task, le, &childq.tasks) in rpc_find_parent()
891 if (task == parent) in rpc_find_parent()
916 struct rpc_task *task; in rpc_new_child() local
918 task = rpc_new_task(clnt, NULL, RPC_TASK_ASYNC | RPC_TASK_CHILD); in rpc_new_child()
919 if (!task) in rpc_new_child()
921 task->tk_exit = rpc_child_exit; in rpc_new_child()
922 task->tk_calldata = parent; in rpc_new_child()
923 return task; in rpc_new_child()
931 rpc_run_child(struct rpc_task *task, struct rpc_task *child, rpc_action func) in rpc_run_child() argument
935 __rpc_sleep_on(&childq, task, func, NULL); in rpc_run_child()