Skip to content

Commit

Permalink
SUNRPC: Add correct rcu_dereference annotation in rpc_clnt_set_transport
Browse files Browse the repository at this point in the history
rpc_clnt_set_transport should use rcu_derefence_protected(), as it is
only safe to be called with the rpc_clnt::cl_lock held.

Cc: Chuck Lever <Chuck.Lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Oct 28, 2013
1 parent 4d4b69d commit 34751b9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/sunrpc/clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ static struct rpc_xprt *rpc_clnt_set_transport(struct rpc_clnt *clnt,
struct rpc_xprt *old;

spin_lock(&clnt->cl_lock);
old = clnt->cl_xprt;
old = rcu_dereference_protected(clnt->cl_xprt,
lockdep_is_held(&clnt->cl_lock));

if (!xprt_bound(xprt))
clnt->cl_autobind = 1;
Expand Down

0 comments on commit 34751b9

Please sign in to comment.