Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

SUNRPC: Ensure that rpc_exit() always wakes up a sleeping task

Make rpc_exit() non-inline, and ensure that it always wakes up a task that
has been queued.

Kill off the now unused rpc_wake_up_task().

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

+10 -17
+1 -6
include/linux/sunrpc/sched.h
··· 213 213 const struct rpc_call_ops *ops); 214 214 void rpc_put_task(struct rpc_task *); 215 215 void rpc_exit_task(struct rpc_task *); 216 + void rpc_exit(struct rpc_task *, int); 216 217 void rpc_release_calldata(const struct rpc_call_ops *, void *); 217 218 void rpc_killall_tasks(struct rpc_clnt *); 218 219 void rpc_execute(struct rpc_task *); ··· 241 240 void rpc_destroy_mempool(void); 242 241 extern struct workqueue_struct *rpciod_workqueue; 243 242 void rpc_prepare_task(struct rpc_task *task); 244 - 245 - static inline void rpc_exit(struct rpc_task *task, int status) 246 - { 247 - task->tk_status = status; 248 - task->tk_action = rpc_exit_task; 249 - } 250 243 251 244 static inline int rpc_wait_for_completion_task(struct rpc_task *task) 252 245 {
+9 -11
net/sunrpc/sched.c
··· 406 406 EXPORT_SYMBOL_GPL(rpc_wake_up_queued_task); 407 407 408 408 /* 409 - * Wake up the specified task 410 - */ 411 - static void rpc_wake_up_task(struct rpc_task *task) 412 - { 413 - rpc_wake_up_queued_task(task->tk_waitqueue, task); 414 - } 415 - 416 - /* 417 409 * Wake up the next task on a priority queue. 418 410 */ 419 411 static struct rpc_task * __rpc_wake_up_next_priority(struct rpc_wait_queue *queue) ··· 592 600 } 593 601 } 594 602 } 595 - EXPORT_SYMBOL_GPL(rpc_exit_task); 603 + 604 + void rpc_exit(struct rpc_task *task, int status) 605 + { 606 + task->tk_status = status; 607 + task->tk_action = rpc_exit_task; 608 + if (RPC_IS_QUEUED(task)) 609 + rpc_wake_up_queued_task(task->tk_waitqueue, task); 610 + } 611 + EXPORT_SYMBOL_GPL(rpc_exit); 596 612 597 613 void rpc_release_calldata(const struct rpc_call_ops *ops, void *calldata) 598 614 { ··· 690 690 dprintk("RPC: %5u got signal\n", task->tk_pid); 691 691 task->tk_flags |= RPC_TASK_KILLED; 692 692 rpc_exit(task, -ERESTARTSYS); 693 - rpc_wake_up_task(task); 694 693 } 695 694 rpc_set_running(task); 696 695 dprintk("RPC: %5u sync task resuming\n", task->tk_pid); ··· 949 950 if (!(rovr->tk_flags & RPC_TASK_KILLED)) { 950 951 rovr->tk_flags |= RPC_TASK_KILLED; 951 952 rpc_exit(rovr, -EIO); 952 - rpc_wake_up_task(rovr); 953 953 } 954 954 } 955 955 spin_unlock(&clnt->cl_lock);