diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2014-03-12 12:51:47 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-03-17 16:04:54 -0400 |
commit | 706cb8db3b629f6021499a5edfdde526a3cf7d95 (patch) | |
tree | ee25472dbcd7be6e96f72e16f7b977aaeb1694d0 | |
parent | 3a0799a94c0384a3b275a73267aaa10517b1bf7d (diff) |
NFS: advertise only supported callback netids
NFSv4.0 clients use the SETCLIENTID operation to inform NFS servers
how to contact a client's callback service. If a server cannot
contact a client's callback service, that server will not delegate
to that client, which results in a performance loss.
Our client advertises "rdma" as the callback netid when the forward
channel is "rdma". But our client always starts only "tcp" and
"tcp6" callback services.
Instead of advertising the forward channel netid, advertise "tcp"
or "tcp6" as the callback netid, based on the value of the
clientaddr mount option, since those are what our client currently
supports.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=69171
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r-- | fs/nfs/nfs4proc.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 025116c66fef..c866e325577f 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -4881,6 +4881,20 @@ nfs4_init_uniform_client_string(const struct nfs_client *clp, | |||
4881 | nodename); | 4881 | nodename); |
4882 | } | 4882 | } |
4883 | 4883 | ||
4884 | /* | ||
4885 | * nfs4_callback_up_net() starts only "tcp" and "tcp6" callback | ||
4886 | * services. Advertise one based on the address family of the | ||
4887 | * clientaddr. | ||
4888 | */ | ||
4889 | static unsigned int | ||
4890 | nfs4_init_callback_netid(const struct nfs_client *clp, char *buf, size_t len) | ||
4891 | { | ||
4892 | if (strchr(clp->cl_ipaddr, ':') != NULL) | ||
4893 | return scnprintf(buf, len, "tcp6"); | ||
4894 | else | ||
4895 | return scnprintf(buf, len, "tcp"); | ||
4896 | } | ||
4897 | |||
4884 | /** | 4898 | /** |
4885 | * nfs4_proc_setclientid - Negotiate client ID | 4899 | * nfs4_proc_setclientid - Negotiate client ID |
4886 | * @clp: state data structure | 4900 | * @clp: state data structure |
@@ -4922,12 +4936,10 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, | |||
4922 | setclientid.sc_name, | 4936 | setclientid.sc_name, |
4923 | sizeof(setclientid.sc_name)); | 4937 | sizeof(setclientid.sc_name)); |
4924 | /* cb_client4 */ | 4938 | /* cb_client4 */ |
4925 | rcu_read_lock(); | 4939 | setclientid.sc_netid_len = |
4926 | setclientid.sc_netid_len = scnprintf(setclientid.sc_netid, | 4940 | nfs4_init_callback_netid(clp, |
4927 | sizeof(setclientid.sc_netid), "%s", | 4941 | setclientid.sc_netid, |
4928 | rpc_peeraddr2str(clp->cl_rpcclient, | 4942 | sizeof(setclientid.sc_netid)); |
4929 | RPC_DISPLAY_NETID)); | ||
4930 | rcu_read_unlock(); | ||
4931 | setclientid.sc_uaddr_len = scnprintf(setclientid.sc_uaddr, | 4943 | setclientid.sc_uaddr_len = scnprintf(setclientid.sc_uaddr, |
4932 | sizeof(setclientid.sc_uaddr), "%s.%u.%u", | 4944 | sizeof(setclientid.sc_uaddr), "%s.%u.%u", |
4933 | clp->cl_ipaddr, port >> 8, port & 255); | 4945 | clp->cl_ipaddr, port >> 8, port & 255); |