diff options
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/callback_proc.c | 9 | ||||
-rw-r--r-- | fs/nfs/client.c | 16 | ||||
-rw-r--r-- | fs/nfs/nfs4namespace.c | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 13 | ||||
-rw-r--r-- | fs/nfs/nfs4state.c | 25 | ||||
-rw-r--r-- | fs/nfs/super.c | 5 |
6 files changed, 49 insertions, 21 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 0e0865e38065..1bb297243624 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/nfs4.h> | 8 | #include <linux/nfs4.h> |
9 | #include <linux/nfs_fs.h> | 9 | #include <linux/nfs_fs.h> |
10 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
11 | #include <linux/rcupdate.h> | ||
11 | #include "nfs4_fs.h" | 12 | #include "nfs4_fs.h" |
12 | #include "callback.h" | 13 | #include "callback.h" |
13 | #include "delegation.h" | 14 | #include "delegation.h" |
@@ -33,7 +34,7 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args, | |||
33 | res->bitmap[0] = res->bitmap[1] = 0; | 34 | res->bitmap[0] = res->bitmap[1] = 0; |
34 | res->status = htonl(NFS4ERR_BADHANDLE); | 35 | res->status = htonl(NFS4ERR_BADHANDLE); |
35 | 36 | ||
36 | dprintk("NFS: GETATTR callback request from %s\n", | 37 | dprintk_rcu("NFS: GETATTR callback request from %s\n", |
37 | rpc_peeraddr2str(cps->clp->cl_rpcclient, RPC_DISPLAY_ADDR)); | 38 | rpc_peeraddr2str(cps->clp->cl_rpcclient, RPC_DISPLAY_ADDR)); |
38 | 39 | ||
39 | inode = nfs_delegation_find_inode(cps->clp, &args->fh); | 40 | inode = nfs_delegation_find_inode(cps->clp, &args->fh); |
@@ -73,7 +74,7 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy, | |||
73 | if (!cps->clp) /* Always set for v4.0. Set in cb_sequence for v4.1 */ | 74 | if (!cps->clp) /* Always set for v4.0. Set in cb_sequence for v4.1 */ |
74 | goto out; | 75 | goto out; |
75 | 76 | ||
76 | dprintk("NFS: RECALL callback request from %s\n", | 77 | dprintk_rcu("NFS: RECALL callback request from %s\n", |
77 | rpc_peeraddr2str(cps->clp->cl_rpcclient, RPC_DISPLAY_ADDR)); | 78 | rpc_peeraddr2str(cps->clp->cl_rpcclient, RPC_DISPLAY_ADDR)); |
78 | 79 | ||
79 | res = htonl(NFS4ERR_BADHANDLE); | 80 | res = htonl(NFS4ERR_BADHANDLE); |
@@ -533,7 +534,7 @@ __be32 nfs4_callback_recallany(struct cb_recallanyargs *args, void *dummy, | |||
533 | if (!cps->clp) /* set in cb_sequence */ | 534 | if (!cps->clp) /* set in cb_sequence */ |
534 | goto out; | 535 | goto out; |
535 | 536 | ||
536 | dprintk("NFS: RECALL_ANY callback request from %s\n", | 537 | dprintk_rcu("NFS: RECALL_ANY callback request from %s\n", |
537 | rpc_peeraddr2str(cps->clp->cl_rpcclient, RPC_DISPLAY_ADDR)); | 538 | rpc_peeraddr2str(cps->clp->cl_rpcclient, RPC_DISPLAY_ADDR)); |
538 | 539 | ||
539 | status = cpu_to_be32(NFS4ERR_INVAL); | 540 | status = cpu_to_be32(NFS4ERR_INVAL); |
@@ -568,7 +569,7 @@ __be32 nfs4_callback_recallslot(struct cb_recallslotargs *args, void *dummy, | |||
568 | if (!cps->clp) /* set in cb_sequence */ | 569 | if (!cps->clp) /* set in cb_sequence */ |
569 | goto out; | 570 | goto out; |
570 | 571 | ||
571 | dprintk("NFS: CB_RECALL_SLOT request from %s target max slots %d\n", | 572 | dprintk_rcu("NFS: CB_RECALL_SLOT request from %s target max slots %d\n", |
572 | rpc_peeraddr2str(cps->clp->cl_rpcclient, RPC_DISPLAY_ADDR), | 573 | rpc_peeraddr2str(cps->clp->cl_rpcclient, RPC_DISPLAY_ADDR), |
573 | args->crsa_target_max_slots); | 574 | args->crsa_target_max_slots); |
574 | 575 | ||
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 1506adf4d4ed..d038dc5916e5 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -1284,16 +1284,18 @@ static int nfs4_init_callback(struct nfs_client *clp) | |||
1284 | int error; | 1284 | int error; |
1285 | 1285 | ||
1286 | if (clp->rpc_ops->version == 4) { | 1286 | if (clp->rpc_ops->version == 4) { |
1287 | struct rpc_xprt *xprt; | ||
1288 | |||
1289 | xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt); | ||
1290 | |||
1287 | if (nfs4_has_session(clp)) { | 1291 | if (nfs4_has_session(clp)) { |
1288 | error = xprt_setup_backchannel( | 1292 | error = xprt_setup_backchannel(xprt, |
1289 | clp->cl_rpcclient->cl_xprt, | ||
1290 | NFS41_BC_MIN_CALLBACKS); | 1293 | NFS41_BC_MIN_CALLBACKS); |
1291 | if (error < 0) | 1294 | if (error < 0) |
1292 | return error; | 1295 | return error; |
1293 | } | 1296 | } |
1294 | 1297 | ||
1295 | error = nfs_callback_up(clp->cl_mvops->minor_version, | 1298 | error = nfs_callback_up(clp->cl_mvops->minor_version, xprt); |
1296 | clp->cl_rpcclient->cl_xprt); | ||
1297 | if (error < 0) { | 1299 | if (error < 0) { |
1298 | dprintk("%s: failed to start callback. Error = %d\n", | 1300 | dprintk("%s: failed to start callback. Error = %d\n", |
1299 | __func__, error); | 1301 | __func__, error); |
@@ -1678,7 +1680,7 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data, | |||
1678 | data->addrlen, | 1680 | data->addrlen, |
1679 | parent_client->cl_ipaddr, | 1681 | parent_client->cl_ipaddr, |
1680 | data->authflavor, | 1682 | data->authflavor, |
1681 | parent_server->client->cl_xprt->prot, | 1683 | rpc_protocol(parent_server->client), |
1682 | parent_server->client->cl_timeout, | 1684 | parent_server->client->cl_timeout, |
1683 | parent_client->cl_mvops->minor_version, | 1685 | parent_client->cl_mvops->minor_version, |
1684 | parent_client->net); | 1686 | parent_client->net); |
@@ -1905,12 +1907,14 @@ static int nfs_server_list_show(struct seq_file *m, void *v) | |||
1905 | if (clp->cl_cons_state != NFS_CS_READY) | 1907 | if (clp->cl_cons_state != NFS_CS_READY) |
1906 | return 0; | 1908 | return 0; |
1907 | 1909 | ||
1910 | rcu_read_lock(); | ||
1908 | seq_printf(m, "v%u %s %s %3d %s\n", | 1911 | seq_printf(m, "v%u %s %s %3d %s\n", |
1909 | clp->rpc_ops->version, | 1912 | clp->rpc_ops->version, |
1910 | rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR), | 1913 | rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR), |
1911 | rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT), | 1914 | rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT), |
1912 | atomic_read(&clp->cl_count), | 1915 | atomic_read(&clp->cl_count), |
1913 | clp->cl_hostname); | 1916 | clp->cl_hostname); |
1917 | rcu_read_unlock(); | ||
1914 | 1918 | ||
1915 | return 0; | 1919 | return 0; |
1916 | } | 1920 | } |
@@ -1993,6 +1997,7 @@ static int nfs_volume_list_show(struct seq_file *m, void *v) | |||
1993 | (unsigned long long) server->fsid.major, | 1997 | (unsigned long long) server->fsid.major, |
1994 | (unsigned long long) server->fsid.minor); | 1998 | (unsigned long long) server->fsid.minor); |
1995 | 1999 | ||
2000 | rcu_read_lock(); | ||
1996 | seq_printf(m, "v%u %s %s %-7s %-17s %s\n", | 2001 | seq_printf(m, "v%u %s %s %-7s %-17s %s\n", |
1997 | clp->rpc_ops->version, | 2002 | clp->rpc_ops->version, |
1998 | rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR), | 2003 | rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR), |
@@ -2000,6 +2005,7 @@ static int nfs_volume_list_show(struct seq_file *m, void *v) | |||
2000 | dev, | 2005 | dev, |
2001 | fsid, | 2006 | fsid, |
2002 | nfs_server_fscache_state(server)); | 2007 | nfs_server_fscache_state(server)); |
2008 | rcu_read_unlock(); | ||
2003 | 2009 | ||
2004 | return 0; | 2010 | return 0; |
2005 | } | 2011 | } |
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index 667ea7406fd3..9c8eca315f43 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
@@ -96,8 +96,8 @@ static int nfs4_validate_fspath(struct dentry *dentry, | |||
96 | static size_t nfs_parse_server_name(char *string, size_t len, | 96 | static size_t nfs_parse_server_name(char *string, size_t len, |
97 | struct sockaddr *sa, size_t salen, struct nfs_server *server) | 97 | struct sockaddr *sa, size_t salen, struct nfs_server *server) |
98 | { | 98 | { |
99 | struct net *net = rpc_net_ns(server->client); | ||
99 | ssize_t ret; | 100 | ssize_t ret; |
100 | struct net *net = server->client->cl_xprt->xprt_net; | ||
101 | 101 | ||
102 | ret = rpc_pton(net, string, len, sa, salen); | 102 | ret = rpc_pton(net, string, len, sa, salen); |
103 | if (ret == 0) { | 103 | if (ret == 0) { |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 6c8e170e2e6b..671510cc14c0 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -3833,6 +3833,7 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, | |||
3833 | *p = htonl((u32)clp->cl_boot_time.tv_nsec); | 3833 | *p = htonl((u32)clp->cl_boot_time.tv_nsec); |
3834 | 3834 | ||
3835 | for(;;) { | 3835 | for(;;) { |
3836 | rcu_read_lock(); | ||
3836 | setclientid.sc_name_len = scnprintf(setclientid.sc_name, | 3837 | setclientid.sc_name_len = scnprintf(setclientid.sc_name, |
3837 | sizeof(setclientid.sc_name), "%s/%s %s %s %u", | 3838 | sizeof(setclientid.sc_name), "%s/%s %s %s %u", |
3838 | clp->cl_ipaddr, | 3839 | clp->cl_ipaddr, |
@@ -3849,6 +3850,7 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, | |||
3849 | setclientid.sc_uaddr_len = scnprintf(setclientid.sc_uaddr, | 3850 | setclientid.sc_uaddr_len = scnprintf(setclientid.sc_uaddr, |
3850 | sizeof(setclientid.sc_uaddr), "%s.%u.%u", | 3851 | sizeof(setclientid.sc_uaddr), "%s.%u.%u", |
3851 | clp->cl_ipaddr, port >> 8, port & 255); | 3852 | clp->cl_ipaddr, port >> 8, port & 255); |
3853 | rcu_read_unlock(); | ||
3852 | 3854 | ||
3853 | status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); | 3855 | status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
3854 | if (status != -NFS4ERR_CLID_INUSE) | 3856 | if (status != -NFS4ERR_CLID_INUSE) |
@@ -5244,11 +5246,16 @@ struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp) | |||
5244 | 5246 | ||
5245 | void nfs4_destroy_session(struct nfs4_session *session) | 5247 | void nfs4_destroy_session(struct nfs4_session *session) |
5246 | { | 5248 | { |
5249 | struct rpc_xprt *xprt; | ||
5250 | |||
5247 | nfs4_proc_destroy_session(session); | 5251 | nfs4_proc_destroy_session(session); |
5252 | |||
5253 | rcu_read_lock(); | ||
5254 | xprt = rcu_dereference(session->clp->cl_rpcclient->cl_xprt); | ||
5255 | rcu_read_unlock(); | ||
5248 | dprintk("%s Destroy backchannel for xprt %p\n", | 5256 | dprintk("%s Destroy backchannel for xprt %p\n", |
5249 | __func__, session->clp->cl_rpcclient->cl_xprt); | 5257 | __func__, xprt); |
5250 | xprt_destroy_backchannel(session->clp->cl_rpcclient->cl_xprt, | 5258 | xprt_destroy_backchannel(xprt, NFS41_BC_MIN_CALLBACKS); |
5251 | NFS41_BC_MIN_CALLBACKS); | ||
5252 | nfs4_destroy_slot_tables(session); | 5259 | nfs4_destroy_slot_tables(session); |
5253 | kfree(session); | 5260 | kfree(session); |
5254 | } | 5261 | } |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index c1111a37dc14..bae959e294cd 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1037,19 +1037,28 @@ static void nfs4_clear_state_manager_bit(struct nfs_client *clp) | |||
1037 | void nfs4_schedule_state_manager(struct nfs_client *clp) | 1037 | void nfs4_schedule_state_manager(struct nfs_client *clp) |
1038 | { | 1038 | { |
1039 | struct task_struct *task; | 1039 | struct task_struct *task; |
1040 | char buf[INET6_ADDRSTRLEN + sizeof("-manager") + 1]; | ||
1040 | 1041 | ||
1041 | if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0) | 1042 | if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0) |
1042 | return; | 1043 | return; |
1043 | __module_get(THIS_MODULE); | 1044 | __module_get(THIS_MODULE); |
1044 | atomic_inc(&clp->cl_count); | 1045 | atomic_inc(&clp->cl_count); |
1045 | task = kthread_run(nfs4_run_state_manager, clp, "%s-manager", | 1046 | |
1046 | rpc_peeraddr2str(clp->cl_rpcclient, | 1047 | /* The rcu_read_lock() is not strictly necessary, as the state |
1047 | RPC_DISPLAY_ADDR)); | 1048 | * manager is the only thread that ever changes the rpc_xprt |
1048 | if (!IS_ERR(task)) | 1049 | * after it's initialized. At this point, we're single threaded. */ |
1049 | return; | 1050 | rcu_read_lock(); |
1050 | nfs4_clear_state_manager_bit(clp); | 1051 | snprintf(buf, sizeof(buf), "%s-manager", |
1051 | nfs_put_client(clp); | 1052 | rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR)); |
1052 | module_put(THIS_MODULE); | 1053 | rcu_read_unlock(); |
1054 | task = kthread_run(nfs4_run_state_manager, clp, buf); | ||
1055 | if (IS_ERR(task)) { | ||
1056 | printk(KERN_ERR "%s: kthread_run: %ld\n", | ||
1057 | __func__, PTR_ERR(task)); | ||
1058 | nfs4_clear_state_manager_bit(clp); | ||
1059 | nfs_put_client(clp); | ||
1060 | module_put(THIS_MODULE); | ||
1061 | } | ||
1053 | } | 1062 | } |
1054 | 1063 | ||
1055 | /* | 1064 | /* |
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 | } |