aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2013-01-08 09:10:21 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-02-01 10:13:47 -0500
commita4f0835c604f80f945ab3e72ffd00547145c4b2b (patch)
treecd883841bad19e0ab7e7aa435bbcac572836ff9e
parent88b62b915b0b7e25870eb0604ed9a92ba4bfc9f7 (diff)
SUNRPC: Eliminate task->tk_xprt accesses that bypass rcu_dereference()
tk_xprt is just a shortcut for tk_client->cl_xprt, however cl_xprt is defined as an __rcu variable. Replace dereferences of tk_xprt with non-rcu dereferences where it is safe to do so. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c2
-rw-r--r--net/sunrpc/clnt.c12
-rw-r--r--net/sunrpc/xprt.c4
-rw-r--r--net/sunrpc/xprtrdma/rpc_rdma.c4
-rw-r--r--net/sunrpc/xprtrdma/transport.c4
-rw-r--r--net/sunrpc/xprtrdma/xprt_rdma.h6
-rw-r--r--net/sunrpc/xprtsock.c2
7 files changed, 18 insertions, 16 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 6e5c824b040b..e7243f9b405d 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -1154,7 +1154,7 @@ gss_marshal(struct rpc_task *task, __be32 *p)
1154 1154
1155 /* We compute the checksum for the verifier over the xdr-encoded bytes 1155 /* We compute the checksum for the verifier over the xdr-encoded bytes
1156 * starting with the xid and ending at the end of the credential: */ 1156 * starting with the xid and ending at the end of the credential: */
1157 iov.iov_base = xprt_skip_transport_header(task->tk_xprt, 1157 iov.iov_base = xprt_skip_transport_header(req->rq_xprt,
1158 req->rq_snd_buf.head[0].iov_base); 1158 req->rq_snd_buf.head[0].iov_base);
1159 iov.iov_len = (u8 *)p - (u8 *)iov.iov_base; 1159 iov.iov_len = (u8 *)p - (u8 *)iov.iov_base;
1160 xdr_buf_from_iov(&iov, &verf_buf); 1160 xdr_buf_from_iov(&iov, &verf_buf);
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 507b5e84fbdb..6b3411ba23f1 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1400,7 +1400,7 @@ call_allocate(struct rpc_task *task)
1400{ 1400{
1401 unsigned int slack = task->tk_rqstp->rq_cred->cr_auth->au_cslack; 1401 unsigned int slack = task->tk_rqstp->rq_cred->cr_auth->au_cslack;
1402 struct rpc_rqst *req = task->tk_rqstp; 1402 struct rpc_rqst *req = task->tk_rqstp;
1403 struct rpc_xprt *xprt = task->tk_xprt; 1403 struct rpc_xprt *xprt = req->rq_xprt;
1404 struct rpc_procinfo *proc = task->tk_msg.rpc_proc; 1404 struct rpc_procinfo *proc = task->tk_msg.rpc_proc;
1405 1405
1406 dprint_status(task); 1406 dprint_status(task);
@@ -1685,7 +1685,7 @@ call_transmit(struct rpc_task *task)
1685 if (rpc_reply_expected(task)) 1685 if (rpc_reply_expected(task))
1686 return; 1686 return;
1687 task->tk_action = rpc_exit_task; 1687 task->tk_action = rpc_exit_task;
1688 rpc_wake_up_queued_task(&task->tk_xprt->pending, task); 1688 rpc_wake_up_queued_task(&task->tk_rqstp->rq_xprt->pending, task);
1689} 1689}
1690 1690
1691/* 1691/*
@@ -1784,7 +1784,7 @@ call_bc_transmit(struct rpc_task *task)
1784 */ 1784 */
1785 printk(KERN_NOTICE "RPC: Could not send backchannel reply " 1785 printk(KERN_NOTICE "RPC: Could not send backchannel reply "
1786 "error: %d\n", task->tk_status); 1786 "error: %d\n", task->tk_status);
1787 xprt_conditional_disconnect(task->tk_xprt, 1787 xprt_conditional_disconnect(req->rq_xprt,
1788 req->rq_connect_cookie); 1788 req->rq_connect_cookie);
1789 break; 1789 break;
1790 default: 1790 default:
@@ -1836,7 +1836,7 @@ call_status(struct rpc_task *task)
1836 case -ETIMEDOUT: 1836 case -ETIMEDOUT:
1837 task->tk_action = call_timeout; 1837 task->tk_action = call_timeout;
1838 if (task->tk_client->cl_discrtry) 1838 if (task->tk_client->cl_discrtry)
1839 xprt_conditional_disconnect(task->tk_xprt, 1839 xprt_conditional_disconnect(req->rq_xprt,
1840 req->rq_connect_cookie); 1840 req->rq_connect_cookie);
1841 break; 1841 break;
1842 case -ECONNRESET: 1842 case -ECONNRESET:
@@ -1991,7 +1991,7 @@ out_retry:
1991 if (task->tk_rqstp == req) { 1991 if (task->tk_rqstp == req) {
1992 req->rq_reply_bytes_recvd = req->rq_rcv_buf.len = 0; 1992 req->rq_reply_bytes_recvd = req->rq_rcv_buf.len = 0;
1993 if (task->tk_client->cl_discrtry) 1993 if (task->tk_client->cl_discrtry)
1994 xprt_conditional_disconnect(task->tk_xprt, 1994 xprt_conditional_disconnect(req->rq_xprt,
1995 req->rq_connect_cookie); 1995 req->rq_connect_cookie);
1996 } 1996 }
1997} 1997}
@@ -2005,7 +2005,7 @@ rpc_encode_header(struct rpc_task *task)
2005 2005
2006 /* FIXME: check buffer size? */ 2006 /* FIXME: check buffer size? */
2007 2007
2008 p = xprt_skip_transport_header(task->tk_xprt, p); 2008 p = xprt_skip_transport_header(req->rq_xprt, p);
2009 *p++ = req->rq_xid; /* XID */ 2009 *p++ = req->rq_xid; /* XID */
2010 *p++ = htonl(RPC_CALL); /* CALL */ 2010 *p++ = htonl(RPC_CALL); /* CALL */
2011 *p++ = htonl(RPC_VERSION); /* RPC version */ 2011 *p++ = htonl(RPC_VERSION); /* RPC version */
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 33811db8788a..738ad59628cd 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -430,7 +430,9 @@ __xprt_put_cong(struct rpc_xprt *xprt, struct rpc_rqst *req)
430 */ 430 */
431void xprt_release_rqst_cong(struct rpc_task *task) 431void xprt_release_rqst_cong(struct rpc_task *task)
432{ 432{
433 __xprt_put_cong(task->tk_xprt, task->tk_rqstp); 433 struct rpc_rqst *req = task->tk_rqstp;
434
435 __xprt_put_cong(req->rq_xprt, req);
434} 436}
435EXPORT_SYMBOL_GPL(xprt_release_rqst_cong); 437EXPORT_SYMBOL_GPL(xprt_release_rqst_cong);
436 438
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index 558fbab574f0..e03725bfe2b8 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -171,7 +171,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
171 struct rpcrdma_msg *headerp, enum rpcrdma_chunktype type) 171 struct rpcrdma_msg *headerp, enum rpcrdma_chunktype type)
172{ 172{
173 struct rpcrdma_req *req = rpcr_to_rdmar(rqst); 173 struct rpcrdma_req *req = rpcr_to_rdmar(rqst);
174 struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_task->tk_xprt); 174 struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_xprt);
175 int nsegs, nchunks = 0; 175 int nsegs, nchunks = 0;
176 unsigned int pos; 176 unsigned int pos;
177 struct rpcrdma_mr_seg *seg = req->rl_segments; 177 struct rpcrdma_mr_seg *seg = req->rl_segments;
@@ -366,7 +366,7 @@ rpcrdma_inline_pullup(struct rpc_rqst *rqst, int pad)
366int 366int
367rpcrdma_marshal_req(struct rpc_rqst *rqst) 367rpcrdma_marshal_req(struct rpc_rqst *rqst)
368{ 368{
369 struct rpc_xprt *xprt = rqst->rq_task->tk_xprt; 369 struct rpc_xprt *xprt = rqst->rq_xprt;
370 struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); 370 struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
371 struct rpcrdma_req *req = rpcr_to_rdmar(rqst); 371 struct rpcrdma_req *req = rpcr_to_rdmar(rqst);
372 char *base; 372 char *base;
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index c9aa7a35f3bf..b357c528d29c 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -475,7 +475,7 @@ xprt_rdma_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task)
475static void * 475static void *
476xprt_rdma_allocate(struct rpc_task *task, size_t size) 476xprt_rdma_allocate(struct rpc_task *task, size_t size)
477{ 477{
478 struct rpc_xprt *xprt = task->tk_xprt; 478 struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt;
479 struct rpcrdma_req *req, *nreq; 479 struct rpcrdma_req *req, *nreq;
480 480
481 req = rpcrdma_buffer_get(&rpcx_to_rdmax(xprt)->rx_buf); 481 req = rpcrdma_buffer_get(&rpcx_to_rdmax(xprt)->rx_buf);
@@ -627,7 +627,7 @@ static int
627xprt_rdma_send_request(struct rpc_task *task) 627xprt_rdma_send_request(struct rpc_task *task)
628{ 628{
629 struct rpc_rqst *rqst = task->tk_rqstp; 629 struct rpc_rqst *rqst = task->tk_rqstp;
630 struct rpc_xprt *xprt = task->tk_xprt; 630 struct rpc_xprt *xprt = rqst->rq_xprt;
631 struct rpcrdma_req *req = rpcr_to_rdmar(rqst); 631 struct rpcrdma_req *req = rpcr_to_rdmar(rqst);
632 struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); 632 struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
633 633
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h
index 9a66c95b5837..cc1445dc1d1a 100644
--- a/net/sunrpc/xprtrdma/xprt_rdma.h
+++ b/net/sunrpc/xprtrdma/xprt_rdma.h
@@ -235,13 +235,13 @@ struct rpcrdma_create_data_internal {
235}; 235};
236 236
237#define RPCRDMA_INLINE_READ_THRESHOLD(rq) \ 237#define RPCRDMA_INLINE_READ_THRESHOLD(rq) \
238 (rpcx_to_rdmad(rq->rq_task->tk_xprt).inline_rsize) 238 (rpcx_to_rdmad(rq->rq_xprt).inline_rsize)
239 239
240#define RPCRDMA_INLINE_WRITE_THRESHOLD(rq)\ 240#define RPCRDMA_INLINE_WRITE_THRESHOLD(rq)\
241 (rpcx_to_rdmad(rq->rq_task->tk_xprt).inline_wsize) 241 (rpcx_to_rdmad(rq->rq_xprt).inline_wsize)
242 242
243#define RPCRDMA_INLINE_PAD_VALUE(rq)\ 243#define RPCRDMA_INLINE_PAD_VALUE(rq)\
244 rpcx_to_rdmad(rq->rq_task->tk_xprt).padding 244 rpcx_to_rdmad(rq->rq_xprt).padding
245 245
246/* 246/*
247 * Statistics for RPCRDMA 247 * Statistics for RPCRDMA
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 68b0a81c31d5..25838901c97f 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -770,7 +770,7 @@ static void xs_tcp_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task)
770 goto out_release; 770 goto out_release;
771 if (req->rq_bytes_sent == req->rq_snd_buf.len) 771 if (req->rq_bytes_sent == req->rq_snd_buf.len)
772 goto out_release; 772 goto out_release;
773 set_bit(XPRT_CLOSE_WAIT, &task->tk_xprt->state); 773 set_bit(XPRT_CLOSE_WAIT, &xprt->state);
774out_release: 774out_release:
775 xprt_release_xprt(xprt, task); 775 xprt_release_xprt(xprt, task);
776} 776}