From 34751b9d04a221da2a74b27ba439f01c0ae30069 Mon Sep 17 00:00:00 2001
From: Trond Myklebust <Trond.Myklebust@netapp.com>
Date: Mon, 28 Oct 2013 16:42:44 -0400
Subject: [PATCH] SUNRPC: Add correct rcu_dereference annotation in
 rpc_clnt_set_transport

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>
---
 net/sunrpc/clnt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index f167d9c8d7dd9..759b78b056a77 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -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;
-- 
2.30.2