Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333178
b: refs/heads/master
c: e984a55
h: refs/heads/master
v: v3
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Oct 1, 2012
1 parent eddfc54 commit ebccb96
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 896526174ce2b6a773e187ebe5a047b68230e2c4
refs/heads/master: e984a55a7418f777407c7edbb2bdf5eb9559b5e2
51 changes: 39 additions & 12 deletions trunk/fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4047,6 +4047,32 @@ static void nfs4_init_boot_verifier(const struct nfs_client *clp,
memcpy(bootverf->data, verf, sizeof(bootverf->data));
}

static unsigned int
nfs4_init_nonuniform_client_string(const struct nfs_client *clp,
char *buf, size_t len)
{
unsigned int result;

rcu_read_lock();
result = scnprintf(buf, len, "Linux NFSv4.0 %s/%s %s",
clp->cl_ipaddr,
rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_ADDR),
rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_PROTO));
rcu_read_unlock();
return result;
}

static unsigned int
nfs4_init_uniform_client_string(const struct nfs_client *clp,
char *buf, size_t len)
{
return scnprintf(buf, len, "Linux NFSv%u.%u %s",
clp->rpc_ops->version, clp->cl_minorversion,
clp->cl_rpcclient->cl_nodename);
}

/**
* nfs4_proc_setclientid - Negotiate client ID
* @clp: state data structure
Expand Down Expand Up @@ -4077,15 +4103,18 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program,

/* nfs_client_id4 */
nfs4_init_boot_verifier(clp, &sc_verifier);
rcu_read_lock();
setclientid.sc_name_len = scnprintf(setclientid.sc_name,
sizeof(setclientid.sc_name), "%s/%s %s",
clp->cl_ipaddr,
rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_ADDR),
rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_PROTO));
if (test_bit(NFS_CS_MIGRATION, &clp->cl_flags))
setclientid.sc_name_len =
nfs4_init_uniform_client_string(clp,
setclientid.sc_name,
sizeof(setclientid.sc_name));
else
setclientid.sc_name_len =
nfs4_init_nonuniform_client_string(clp,
setclientid.sc_name,
sizeof(setclientid.sc_name));
/* cb_client4 */
rcu_read_lock();
setclientid.sc_netid_len = scnprintf(setclientid.sc_netid,
sizeof(setclientid.sc_netid),
rpc_peeraddr2str(clp->cl_rpcclient,
Expand Down Expand Up @@ -5307,10 +5336,8 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
};

nfs4_init_boot_verifier(clp, &verifier);
args.id_len = scnprintf(args.id, sizeof(args.id),
"%s/%s",
clp->cl_ipaddr,
clp->cl_rpcclient->cl_nodename);
args.id_len = nfs4_init_uniform_client_string(clp, args.id,
sizeof(args.id));
dprintk("NFS call exchange_id auth=%s, '%.*s'\n",
clp->cl_rpcclient->cl_auth->au_ops->au_name,
args.id_len, args.id);
Expand Down

0 comments on commit ebccb96

Please sign in to comment.