提交 a4f0835c 编写于 作者: T Trond Myklebust

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: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 88b62b91
...@@ -1154,7 +1154,7 @@ gss_marshal(struct rpc_task *task, __be32 *p) ...@@ -1154,7 +1154,7 @@ gss_marshal(struct rpc_task *task, __be32 *p)
/* We compute the checksum for the verifier over the xdr-encoded bytes /* We compute the checksum for the verifier over the xdr-encoded bytes
* starting with the xid and ending at the end of the credential: */ * starting with the xid and ending at the end of the credential: */
iov.iov_base = xprt_skip_transport_header(task->tk_xprt, iov.iov_base = xprt_skip_transport_header(req->rq_xprt,
req->rq_snd_buf.head[0].iov_base); req->rq_snd_buf.head[0].iov_base);
iov.iov_len = (u8 *)p - (u8 *)iov.iov_base; iov.iov_len = (u8 *)p - (u8 *)iov.iov_base;
xdr_buf_from_iov(&iov, &verf_buf); xdr_buf_from_iov(&iov, &verf_buf);
......
...@@ -1400,7 +1400,7 @@ call_allocate(struct rpc_task *task) ...@@ -1400,7 +1400,7 @@ call_allocate(struct rpc_task *task)
{ {
unsigned int slack = task->tk_rqstp->rq_cred->cr_auth->au_cslack; unsigned int slack = task->tk_rqstp->rq_cred->cr_auth->au_cslack;
struct rpc_rqst *req = task->tk_rqstp; struct rpc_rqst *req = task->tk_rqstp;
struct rpc_xprt *xprt = task->tk_xprt; struct rpc_xprt *xprt = req->rq_xprt;
struct rpc_procinfo *proc = task->tk_msg.rpc_proc; struct rpc_procinfo *proc = task->tk_msg.rpc_proc;
dprint_status(task); dprint_status(task);
...@@ -1685,7 +1685,7 @@ call_transmit(struct rpc_task *task) ...@@ -1685,7 +1685,7 @@ call_transmit(struct rpc_task *task)
if (rpc_reply_expected(task)) if (rpc_reply_expected(task))
return; return;
task->tk_action = rpc_exit_task; task->tk_action = rpc_exit_task;
rpc_wake_up_queued_task(&task->tk_xprt->pending, task); rpc_wake_up_queued_task(&task->tk_rqstp->rq_xprt->pending, task);
} }
/* /*
...@@ -1784,7 +1784,7 @@ call_bc_transmit(struct rpc_task *task) ...@@ -1784,7 +1784,7 @@ call_bc_transmit(struct rpc_task *task)
*/ */
printk(KERN_NOTICE "RPC: Could not send backchannel reply " printk(KERN_NOTICE "RPC: Could not send backchannel reply "
"error: %d\n", task->tk_status); "error: %d\n", task->tk_status);
xprt_conditional_disconnect(task->tk_xprt, xprt_conditional_disconnect(req->rq_xprt,
req->rq_connect_cookie); req->rq_connect_cookie);
break; break;
default: default:
...@@ -1836,7 +1836,7 @@ call_status(struct rpc_task *task) ...@@ -1836,7 +1836,7 @@ call_status(struct rpc_task *task)
case -ETIMEDOUT: case -ETIMEDOUT:
task->tk_action = call_timeout; task->tk_action = call_timeout;
if (task->tk_client->cl_discrtry) if (task->tk_client->cl_discrtry)
xprt_conditional_disconnect(task->tk_xprt, xprt_conditional_disconnect(req->rq_xprt,
req->rq_connect_cookie); req->rq_connect_cookie);
break; break;
case -ECONNRESET: case -ECONNRESET:
...@@ -1991,7 +1991,7 @@ call_decode(struct rpc_task *task) ...@@ -1991,7 +1991,7 @@ call_decode(struct rpc_task *task)
if (task->tk_rqstp == req) { if (task->tk_rqstp == req) {
req->rq_reply_bytes_recvd = req->rq_rcv_buf.len = 0; req->rq_reply_bytes_recvd = req->rq_rcv_buf.len = 0;
if (task->tk_client->cl_discrtry) if (task->tk_client->cl_discrtry)
xprt_conditional_disconnect(task->tk_xprt, xprt_conditional_disconnect(req->rq_xprt,
req->rq_connect_cookie); req->rq_connect_cookie);
} }
} }
...@@ -2005,7 +2005,7 @@ rpc_encode_header(struct rpc_task *task) ...@@ -2005,7 +2005,7 @@ rpc_encode_header(struct rpc_task *task)
/* FIXME: check buffer size? */ /* FIXME: check buffer size? */
p = xprt_skip_transport_header(task->tk_xprt, p); p = xprt_skip_transport_header(req->rq_xprt, p);
*p++ = req->rq_xid; /* XID */ *p++ = req->rq_xid; /* XID */
*p++ = htonl(RPC_CALL); /* CALL */ *p++ = htonl(RPC_CALL); /* CALL */
*p++ = htonl(RPC_VERSION); /* RPC version */ *p++ = htonl(RPC_VERSION); /* RPC version */
......
...@@ -430,7 +430,9 @@ __xprt_put_cong(struct rpc_xprt *xprt, struct rpc_rqst *req) ...@@ -430,7 +430,9 @@ __xprt_put_cong(struct rpc_xprt *xprt, struct rpc_rqst *req)
*/ */
void xprt_release_rqst_cong(struct rpc_task *task) void xprt_release_rqst_cong(struct rpc_task *task)
{ {
__xprt_put_cong(task->tk_xprt, task->tk_rqstp); struct rpc_rqst *req = task->tk_rqstp;
__xprt_put_cong(req->rq_xprt, req);
} }
EXPORT_SYMBOL_GPL(xprt_release_rqst_cong); EXPORT_SYMBOL_GPL(xprt_release_rqst_cong);
......
...@@ -171,7 +171,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target, ...@@ -171,7 +171,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
struct rpcrdma_msg *headerp, enum rpcrdma_chunktype type) struct rpcrdma_msg *headerp, enum rpcrdma_chunktype type)
{ {
struct rpcrdma_req *req = rpcr_to_rdmar(rqst); struct rpcrdma_req *req = rpcr_to_rdmar(rqst);
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_task->tk_xprt); struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_xprt);
int nsegs, nchunks = 0; int nsegs, nchunks = 0;
unsigned int pos; unsigned int pos;
struct rpcrdma_mr_seg *seg = req->rl_segments; struct rpcrdma_mr_seg *seg = req->rl_segments;
...@@ -366,7 +366,7 @@ rpcrdma_inline_pullup(struct rpc_rqst *rqst, int pad) ...@@ -366,7 +366,7 @@ rpcrdma_inline_pullup(struct rpc_rqst *rqst, int pad)
int int
rpcrdma_marshal_req(struct rpc_rqst *rqst) rpcrdma_marshal_req(struct rpc_rqst *rqst)
{ {
struct rpc_xprt *xprt = rqst->rq_task->tk_xprt; struct rpc_xprt *xprt = rqst->rq_xprt;
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
struct rpcrdma_req *req = rpcr_to_rdmar(rqst); struct rpcrdma_req *req = rpcr_to_rdmar(rqst);
char *base; char *base;
......
...@@ -475,7 +475,7 @@ xprt_rdma_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task) ...@@ -475,7 +475,7 @@ xprt_rdma_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task)
static void * static void *
xprt_rdma_allocate(struct rpc_task *task, size_t size) xprt_rdma_allocate(struct rpc_task *task, size_t size)
{ {
struct rpc_xprt *xprt = task->tk_xprt; struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt;
struct rpcrdma_req *req, *nreq; struct rpcrdma_req *req, *nreq;
req = rpcrdma_buffer_get(&rpcx_to_rdmax(xprt)->rx_buf); req = rpcrdma_buffer_get(&rpcx_to_rdmax(xprt)->rx_buf);
...@@ -627,7 +627,7 @@ static int ...@@ -627,7 +627,7 @@ static int
xprt_rdma_send_request(struct rpc_task *task) xprt_rdma_send_request(struct rpc_task *task)
{ {
struct rpc_rqst *rqst = task->tk_rqstp; struct rpc_rqst *rqst = task->tk_rqstp;
struct rpc_xprt *xprt = task->tk_xprt; struct rpc_xprt *xprt = rqst->rq_xprt;
struct rpcrdma_req *req = rpcr_to_rdmar(rqst); struct rpcrdma_req *req = rpcr_to_rdmar(rqst);
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
......
...@@ -235,13 +235,13 @@ struct rpcrdma_create_data_internal { ...@@ -235,13 +235,13 @@ struct rpcrdma_create_data_internal {
}; };
#define RPCRDMA_INLINE_READ_THRESHOLD(rq) \ #define RPCRDMA_INLINE_READ_THRESHOLD(rq) \
(rpcx_to_rdmad(rq->rq_task->tk_xprt).inline_rsize) (rpcx_to_rdmad(rq->rq_xprt).inline_rsize)
#define RPCRDMA_INLINE_WRITE_THRESHOLD(rq)\ #define RPCRDMA_INLINE_WRITE_THRESHOLD(rq)\
(rpcx_to_rdmad(rq->rq_task->tk_xprt).inline_wsize) (rpcx_to_rdmad(rq->rq_xprt).inline_wsize)
#define RPCRDMA_INLINE_PAD_VALUE(rq)\ #define RPCRDMA_INLINE_PAD_VALUE(rq)\
rpcx_to_rdmad(rq->rq_task->tk_xprt).padding rpcx_to_rdmad(rq->rq_xprt).padding
/* /*
* Statistics for RPCRDMA * Statistics for RPCRDMA
......
...@@ -770,7 +770,7 @@ static void xs_tcp_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task) ...@@ -770,7 +770,7 @@ static void xs_tcp_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task)
goto out_release; goto out_release;
if (req->rq_bytes_sent == req->rq_snd_buf.len) if (req->rq_bytes_sent == req->rq_snd_buf.len)
goto out_release; goto out_release;
set_bit(XPRT_CLOSE_WAIT, &task->tk_xprt->state); set_bit(XPRT_CLOSE_WAIT, &xprt->state);
out_release: out_release:
xprt_release_xprt(xprt, task); xprt_release_xprt(xprt, task);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册