diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2007-03-29 16:47:58 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-05-01 01:17:11 -0400 |
commit | c5a4dd8b7c15927a8fbff83171b57cad675a79b9 (patch) | |
tree | 2d3b1930449b31f69dc70a6e1d4e0f0532f3f118 /net/sunrpc/clnt.c | |
parent | 2bea90d43a050bbc4021d44e59beb34f384438db (diff) |
SUNRPC: Eliminate side effects from rpc_malloc
Currently rpc_malloc sets req->rq_buffer internally. Make this a more
generic interface: return a pointer to the new buffer (or NULL) and
make the caller set req->rq_buffer and req->rq_bufsize. This looks much
more like kmalloc and eliminates the side effects.
To fix a potential deadlock, this patch also replaces GFP_NOFS with
GFP_NOWAIT in rpc_malloc. This prevents async RPCs from sleeping outside
the RPC's task scheduler while allocating their buffer.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r-- | net/sunrpc/clnt.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 12487aafaab5..e7dc09ecc470 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -774,7 +774,8 @@ call_allocate(struct rpc_task *task) | |||
774 | req->rq_rcvsize = RPC_REPHDRSIZE + slack + proc->p_replen; | 774 | req->rq_rcvsize = RPC_REPHDRSIZE + slack + proc->p_replen; |
775 | req->rq_rcvsize <<= 2; | 775 | req->rq_rcvsize <<= 2; |
776 | 776 | ||
777 | xprt->ops->buf_alloc(task, req->rq_callsize + req->rq_rcvsize); | 777 | req->rq_buffer = xprt->ops->buf_alloc(task, |
778 | req->rq_callsize + req->rq_rcvsize); | ||
778 | if (req->rq_buffer != NULL) | 779 | if (req->rq_buffer != NULL) |
779 | return; | 780 | return; |
780 | 781 | ||