aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4proc.c51
1 files changed, 39 insertions, 12 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5b3207f557d..46141117196 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4047,6 +4047,32 @@ static void nfs4_init_boot_verifier(const struct nfs_client *clp,
4047 memcpy(bootverf->data, verf, sizeof(bootverf->data)); 4047 memcpy(bootverf->data, verf, sizeof(bootverf->data));
4048} 4048}
4049 4049
4050static unsigned int
4051nfs4_init_nonuniform_client_string(const struct nfs_client *clp,
4052 char *buf, size_t len)
4053{
4054 unsigned int result;
4055
4056 rcu_read_lock();
4057 result = scnprintf(buf, len, "Linux NFSv4.0 %s/%s %s",
4058 clp->cl_ipaddr,
4059 rpc_peeraddr2str(clp->cl_rpcclient,
4060 RPC_DISPLAY_ADDR),
4061 rpc_peeraddr2str(clp->cl_rpcclient,
4062 RPC_DISPLAY_PROTO));
4063 rcu_read_unlock();
4064 return result;
4065}
4066
4067static unsigned int
4068nfs4_init_uniform_client_string(const struct nfs_client *clp,
4069 char *buf, size_t len)
4070{
4071 return scnprintf(buf, len, "Linux NFSv%u.%u %s",
4072 clp->rpc_ops->version, clp->cl_minorversion,
4073 clp->cl_rpcclient->cl_nodename);
4074}
4075
4050/** 4076/**
4051 * nfs4_proc_setclientid - Negotiate client ID 4077 * nfs4_proc_setclientid - Negotiate client ID
4052 * @clp: state data structure 4078 * @clp: state data structure
@@ -4077,15 +4103,18 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program,
4077 4103
4078 /* nfs_client_id4 */ 4104 /* nfs_client_id4 */
4079 nfs4_init_boot_verifier(clp, &sc_verifier); 4105 nfs4_init_boot_verifier(clp, &sc_verifier);
4080 rcu_read_lock(); 4106 if (test_bit(NFS_CS_MIGRATION, &clp->cl_flags))
4081 setclientid.sc_name_len = scnprintf(setclientid.sc_name, 4107 setclientid.sc_name_len =
4082 sizeof(setclientid.sc_name), "%s/%s %s", 4108 nfs4_init_uniform_client_string(clp,
4083 clp->cl_ipaddr, 4109 setclientid.sc_name,
4084 rpc_peeraddr2str(clp->cl_rpcclient, 4110 sizeof(setclientid.sc_name));
4085 RPC_DISPLAY_ADDR), 4111 else
4086 rpc_peeraddr2str(clp->cl_rpcclient, 4112 setclientid.sc_name_len =
4087 RPC_DISPLAY_PROTO)); 4113 nfs4_init_nonuniform_client_string(clp,
4114 setclientid.sc_name,
4115 sizeof(setclientid.sc_name));
4088 /* cb_client4 */ 4116 /* cb_client4 */
4117 rcu_read_lock();
4089 setclientid.sc_netid_len = scnprintf(setclientid.sc_netid, 4118 setclientid.sc_netid_len = scnprintf(setclientid.sc_netid,
4090 sizeof(setclientid.sc_netid), 4119 sizeof(setclientid.sc_netid),
4091 rpc_peeraddr2str(clp->cl_rpcclient, 4120 rpc_peeraddr2str(clp->cl_rpcclient,
@@ -5307,10 +5336,8 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
5307 }; 5336 };
5308 5337
5309 nfs4_init_boot_verifier(clp, &verifier); 5338 nfs4_init_boot_verifier(clp, &verifier);
5310 args.id_len = scnprintf(args.id, sizeof(args.id), 5339 args.id_len = nfs4_init_uniform_client_string(clp, args.id,
5311 "%s/%s", 5340 sizeof(args.id));
5312 clp->cl_ipaddr,
5313 clp->cl_rpcclient->cl_nodename);
5314 dprintk("NFS call exchange_id auth=%s, '%.*s'\n", 5341 dprintk("NFS call exchange_id auth=%s, '%.*s'\n",
5315 clp->cl_rpcclient->cl_auth->au_ops->au_name, 5342 clp->cl_rpcclient->cl_auth->au_ops->au_name,
5316 args.id_len, args.id); 5343 args.id_len, args.id);