aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@fieldses.org>2005-10-13 16:54:43 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-10-19 02:19:43 -0400
commitead5e1c26fdcd969cf40c49cb0589d56879d240d (patch)
treeaf0e04aed32eac60b35c987b933dbc132f0e780b
parent293f1eb551a77fe5c8956a559a3c0baea95cd9bc (diff)
SUNRPC: Provide a callback to allow free pages allocated during xdr encoding
For privacy, we need to allocate pages to store the encrypted data (passed in pages can't be used without the risk of corrupting data in the page cache). So we need a way to free that memory after the request has been transmitted. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--include/linux/sunrpc/xprt.h5
-rw-r--r--net/sunrpc/xprt.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 068e1fb0868b..3b8b6e823c70 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -73,7 +73,10 @@ struct rpc_rqst {
73 int rq_cong; /* has incremented xprt->cong */ 73 int rq_cong; /* has incremented xprt->cong */
74 int rq_received; /* receive completed */ 74 int rq_received; /* receive completed */
75 u32 rq_seqno; /* gss seq no. used on req. */ 75 u32 rq_seqno; /* gss seq no. used on req. */
76 76 int rq_enc_pages_num;
77 struct page **rq_enc_pages; /* scratch pages for use by
78 gss privacy code */
79 void (*rq_release_snd_buf)(struct rpc_rqst *); /* release rq_enc_pages */
77 struct list_head rq_list; 80 struct list_head rq_list;
78 81
79 struct xdr_buf rq_private_buf; /* The receive buffer 82 struct xdr_buf rq_private_buf; /* The receive buffer
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 1ba55dc38b7a..6dda3860351f 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -839,6 +839,7 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
839 req->rq_task = task; 839 req->rq_task = task;
840 req->rq_xprt = xprt; 840 req->rq_xprt = xprt;
841 req->rq_xid = xprt_alloc_xid(xprt); 841 req->rq_xid = xprt_alloc_xid(xprt);
842 req->rq_release_snd_buf = NULL;
842 dprintk("RPC: %4d reserved req %p xid %08x\n", task->tk_pid, 843 dprintk("RPC: %4d reserved req %p xid %08x\n", task->tk_pid,
843 req, ntohl(req->rq_xid)); 844 req, ntohl(req->rq_xid));
844} 845}
@@ -867,6 +868,8 @@ void xprt_release(struct rpc_task *task)
867 xprt->last_used + xprt->idle_timeout); 868 xprt->last_used + xprt->idle_timeout);
868 spin_unlock_bh(&xprt->transport_lock); 869 spin_unlock_bh(&xprt->transport_lock);
869 task->tk_rqstp = NULL; 870 task->tk_rqstp = NULL;
871 if (req->rq_release_snd_buf)
872 req->rq_release_snd_buf(req);
870 memset(req, 0, sizeof(*req)); /* mark unused */ 873 memset(req, 0, sizeof(*req)); /* mark unused */
871 874
872 dprintk("RPC: %4d release request %p\n", task->tk_pid, req); 875 dprintk("RPC: %4d release request %p\n", task->tk_pid, req);