aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/super.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-03-01 17:00:56 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-03-02 15:36:38 -0500
commit2446ab6070861aba2dd9229463ffbc40016a9f33 (patch)
tree2e366c3236788936b9f4f58c0787ae01c265f4a4 /fs/nfs/super.c
parenta3ca5651cb5eebe2e56e510bbf5cd60abc301c9f (diff)
SUNRPC: Use RCU to dereference the rpc_clnt.cl_xprt field
A migration event will replace the rpc_xprt used by an rpc_clnt. To ensure this can be done safely, all references to cl_xprt must now use a form of rcu_dereference(). Special care is taken with rpc_peeraddr2str(), which returns a pointer to memory whose lifetime is the same as the rpc_xprt. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> [ cel: fix lockdep splats and layering violations ] [ cel: forward ported to 3.4 ] [ cel: remove rpc_max_reqs(), add rpc_net_ns() ] Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/super.c')
-rw-r--r--fs/nfs/super.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index f4ccdae6a0cf..7002be11d99f 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -53,6 +53,7 @@
53#include <linux/magic.h> 53#include <linux/magic.h>
54#include <linux/parser.h> 54#include <linux/parser.h>
55#include <linux/nsproxy.h> 55#include <linux/nsproxy.h>
56#include <linux/rcupdate.h>
56 57
57#include <asm/system.h> 58#include <asm/system.h>
58#include <asm/uaccess.h> 59#include <asm/uaccess.h>
@@ -701,8 +702,10 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
701 else 702 else
702 seq_puts(m, nfs_infop->nostr); 703 seq_puts(m, nfs_infop->nostr);
703 } 704 }
705 rcu_read_lock();
704 seq_printf(m, ",proto=%s", 706 seq_printf(m, ",proto=%s",
705 rpc_peeraddr2str(nfss->client, RPC_DISPLAY_NETID)); 707 rpc_peeraddr2str(nfss->client, RPC_DISPLAY_NETID));
708 rcu_read_unlock();
706 if (version == 4) { 709 if (version == 4) {
707 if (nfss->port != NFS_PORT) 710 if (nfss->port != NFS_PORT)
708 seq_printf(m, ",port=%u", nfss->port); 711 seq_printf(m, ",port=%u", nfss->port);
@@ -751,9 +754,11 @@ static int nfs_show_options(struct seq_file *m, struct dentry *root)
751 754
752 nfs_show_mount_options(m, nfss, 0); 755 nfs_show_mount_options(m, nfss, 0);
753 756
757 rcu_read_lock();
754 seq_printf(m, ",addr=%s", 758 seq_printf(m, ",addr=%s",
755 rpc_peeraddr2str(nfss->nfs_client->cl_rpcclient, 759 rpc_peeraddr2str(nfss->nfs_client->cl_rpcclient,
756 RPC_DISPLAY_ADDR)); 760 RPC_DISPLAY_ADDR));
761 rcu_read_unlock();
757 762
758 return 0; 763 return 0;
759} 764}