X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=net%2Fsunrpc%2Fsched.c;h=4c669121e607f774b7739a326639e8f2aec146a3;hb=061964fb988ca51087948975da66ff523b3a5852;hp=b9061bcf6fc155cce2eaa2e582b0c7168967f344;hpb=3ff7576ddac06c3d07089e241b40826d24bbf1ac;p=linux-2.6 diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index b9061bcf6f..4c669121e6 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -45,7 +45,7 @@ static void rpc_release_task(struct rpc_task *task); /* * RPC tasks sit here while waiting for conditions to improve. */ -static RPC_WAITQ(delay_queue, "delayq"); +static struct rpc_wait_queue delay_queue; /* * rpciod-related stuff @@ -245,9 +245,9 @@ void rpc_init_wait_queue(struct rpc_wait_queue *queue, const char *qname) } EXPORT_SYMBOL_GPL(rpc_init_wait_queue); -static int rpc_wait_bit_interruptible(void *word) +static int rpc_wait_bit_killable(void *word) { - if (signal_pending(current)) + if (fatal_signal_pending(current)) return -ERESTARTSYS; schedule(); return 0; @@ -299,9 +299,9 @@ static void rpc_mark_complete_task(struct rpc_task *task) int __rpc_wait_for_completion_task(struct rpc_task *task, int (*action)(void *)) { if (action == NULL) - action = rpc_wait_bit_interruptible; + action = rpc_wait_bit_killable; return wait_on_bit(&task->tk_runstate, RPC_TASK_ACTIVE, - action, TASK_INTERRUPTIBLE); + action, TASK_KILLABLE); } EXPORT_SYMBOL_GPL(__rpc_wait_for_completion_task); @@ -696,10 +696,9 @@ static void __rpc_execute(struct rpc_task *task) /* sync task: sleep here */ dprintk("RPC: %5u sync task going to sleep\n", task->tk_pid); - /* Note: Caller should be using rpc_clnt_sigmask() */ status = out_of_line_wait_on_bit(&task->tk_runstate, - RPC_TASK_QUEUED, rpc_wait_bit_interruptible, - TASK_INTERRUPTIBLE); + RPC_TASK_QUEUED, rpc_wait_bit_killable, + TASK_KILLABLE); if (status == -ERESTARTSYS) { /* * When a sync task receives a signal, it exits with @@ -737,7 +736,6 @@ void rpc_execute(struct rpc_task *task) rpc_set_running(task); __rpc_execute(task); } -EXPORT_SYMBOL_GPL(rpc_execute); static void rpc_async_schedule(struct work_struct *work) { @@ -815,7 +813,7 @@ EXPORT_SYMBOL_GPL(rpc_free); /* * Creation and deletion of RPC task structures */ -void rpc_init_task(struct rpc_task *task, const struct rpc_task_setup *task_setup_data) +static void rpc_init_task(struct rpc_task *task, const struct rpc_task_setup *task_setup_data) { memset(task, 0, sizeof(*task)); setup_timer(&task->tk_timer, (void (*)(unsigned long))rpc_run_timer, @@ -841,20 +839,28 @@ void rpc_init_task(struct rpc_task *task, const struct rpc_task_setup *task_setu kref_get(&task->tk_client->cl_kref); if (task->tk_client->cl_softrtry) task->tk_flags |= RPC_TASK_SOFT; - if (!task->tk_client->cl_intr) - task->tk_flags |= RPC_TASK_NOINTR; } if (task->tk_ops->rpc_call_prepare != NULL) task->tk_action = rpc_prepare_task; + if (task_setup_data->rpc_message != NULL) { + memcpy(&task->tk_msg, task_setup_data->rpc_message, sizeof(task->tk_msg)); + /* Bind the user cred */ + if (task->tk_msg.rpc_cred != NULL) + rpcauth_holdcred(task); + else + rpcauth_bindcred(task); + if (task->tk_action == NULL) + rpc_call_start(task); + } + /* starting timestamp */ task->tk_start = jiffies; dprintk("RPC: new task initialized, procpid %u\n", task_pid_nr(current)); } -EXPORT_SYMBOL_GPL(rpc_init_task); static struct rpc_task * rpc_alloc_task(void) @@ -874,16 +880,20 @@ static void rpc_free_task(struct rcu_head *rcu) */ struct rpc_task *rpc_new_task(const struct rpc_task_setup *setup_data) { - struct rpc_task *task; - - task = rpc_alloc_task(); - if (!task) - goto out; + struct rpc_task *task = setup_data->task; + unsigned short flags = 0; + + if (task == NULL) { + task = rpc_alloc_task(); + if (task == NULL) + goto out; + flags = RPC_TASK_DYNAMIC; + } rpc_init_task(task, setup_data); + task->tk_flags |= flags; dprintk("RPC: allocated task %p\n", task); - task->tk_flags |= RPC_TASK_DYNAMIC; out: return task; } @@ -1046,6 +1056,11 @@ rpc_init_mempool(void) goto err_nomem; if (!rpciod_start()) goto err_nomem; + /* + * The following is not strictly a mempool initialisation, + * but there is no harm in doing it here + */ + rpc_init_wait_queue(&delay_queue, "delayq"); return 0; err_nomem: rpc_destroy_mempool();