/* * 2. Allocate the buffer. For details, see sched.c:rpc_malloc. * (Note: buffer memory is freed in rpc_task_release). */ static void call_allocate(struct rpc_task *task) { struct rpc_clnt *clnt = task->tk_client; unsigned int bufsiz; dprintk("RPC: %4d call_allocate (status %d)\n", task->tk_pid, task->tk_status); task->tk_action = call_encode; if (task->tk_buffer) return; /* FIXME: compute buffer requirements more exactly using * auth->au_wslack */ bufsiz = rpcproc_bufsiz(clnt, task->tk_msg.rpc_proc) + RPC_SLACK_SPACE; if ((task->tk_buffer = rpc_malloc(task, bufsiz << 1)) != NULL) return; printk(KERN_INFO "RPC: buffer allocation failed for task %p\n", task); if (RPC_IS_ASYNC(task) || !(task->tk_client->cl_intr && signalled())) { xprt_release(task); task->tk_action = call_reserve; rpc_delay(task, HZ>>4); return; }
/* * 2. Allocate the buffer. For details, see sched.c:rpc_malloc. * (Note: buffer memory is freed in rpc_task_release). */ static void call_allocate(struct rpc_task *task) { struct rpc_clnt *clnt = task->tk_client; unsigned int bufsiz; dprintk("RPC: %4d call_allocate (status %d)\n", task->tk_pid, task->tk_status); task->tk_action = call_encode; if (task->tk_buffer) return; /* FIXME: compute buffer requirements more exactly using * auth->au_wslack */ bufsiz = rpcproc_bufsiz(clnt, task->tk_proc) + RPC_SLACK_SPACE; if ((task->tk_buffer = rpc_malloc(task, bufsiz)) != NULL) return; printk("RPC: buffer allocation failed for task %p\n", task); if (!signalled()) { xprt_release(task); task->tk_action = call_reserve; rpc_delay(task, HZ); return; } rpc_exit(task, -ERESTARTSYS); }
/* * 8. Refresh the credentials if rejected by the server */ static void call_refresh(struct rpc_task *task) { dprintk("RPC: %4d call_refresh\n", task->tk_pid); xprt_release(task); /* Must do to obtain new XID */ task->tk_action = call_refreshresult; task->tk_status = 0; task->tk_client->cl_stats->rpcauthrefresh++; rpcauth_refreshcred(task); }
void rpc_release_task(struct rpc_task *task) { struct rpc_task *next, *prev; dprintk("RPC: %4d release task\n", task->tk_pid); /* Remove from global task list */ prev = task->tk_prev_task; next = task->tk_next_task; if (next) next->tk_prev_task = prev; if (prev) prev->tk_next_task = next; else all_tasks = next; /* Release resources */ if (task->tk_rqstp) xprt_release(task); if (task->tk_cred) rpcauth_releasecred(task); if (task->tk_buffer) { rpc_free(task->tk_buffer); task->tk_buffer = NULL; } if (task->tk_client) { rpc_release_client(task->tk_client); task->tk_client = NULL; } #ifdef RPC_DEBUG task->tk_magic = 0; #endif if (task->tk_flags & RPC_TASK_DYNAMIC) { dprintk("RPC: %4d freeing task\n", task->tk_pid); task->tk_flags &= ~RPC_TASK_DYNAMIC; rpc_free(task); } }