summaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@poochiereds.net>2015-06-09 19:43:57 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-06-16 11:15:31 -0400
commit3a6bb738792500e8b4534c0350c13a132bac0492 (patch)
treeacc786a4630b7f3f6615795f7837a126df470f4e /fs/nfs/nfs4xdr.c
parent764ad8ba8cd4c6f836fca9378f8c5121aece0842 (diff)
nfs: convert setclientid and exchange_id encoders to use clp->cl_owner_id
...instead of buffers that are part of their arg structs. We already hold a reference to the client, so we might as well use the allocated buffer. In the event that we can't allocate the clp->cl_owner_id, then just return -ENOMEM. Note too that we switch from a GFP_KERNEL allocation here to GFP_NOFS. It's possible we could end up trying to do a SETCLIENTID or EXCHANGE_ID in order to reclaim some memory, and the GFP_KERNEL allocations in the existing code could cause recursion back into NFS reclaim. Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 0aea97841d30..f58e8a979397 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1667,13 +1667,14 @@ static void encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclie
1667 encode_op_hdr(xdr, OP_SETCLIENTID, decode_setclientid_maxsz, hdr); 1667 encode_op_hdr(xdr, OP_SETCLIENTID, decode_setclientid_maxsz, hdr);
1668 encode_nfs4_verifier(xdr, setclientid->sc_verifier); 1668 encode_nfs4_verifier(xdr, setclientid->sc_verifier);
1669 1669
1670 encode_string(xdr, setclientid->sc_name_len, setclientid->sc_name); 1670 encode_string(xdr, strlen(setclientid->sc_clnt->cl_owner_id),
1671 setclientid->sc_clnt->cl_owner_id);
1671 p = reserve_space(xdr, 4); 1672 p = reserve_space(xdr, 4);
1672 *p = cpu_to_be32(setclientid->sc_prog); 1673 *p = cpu_to_be32(setclientid->sc_prog);
1673 encode_string(xdr, setclientid->sc_netid_len, setclientid->sc_netid); 1674 encode_string(xdr, setclientid->sc_netid_len, setclientid->sc_netid);
1674 encode_string(xdr, setclientid->sc_uaddr_len, setclientid->sc_uaddr); 1675 encode_string(xdr, setclientid->sc_uaddr_len, setclientid->sc_uaddr);
1675 p = reserve_space(xdr, 4); 1676 p = reserve_space(xdr, 4);
1676 *p = cpu_to_be32(setclientid->sc_cb_ident); 1677 *p = cpu_to_be32(setclientid->sc_clnt->cl_cb_ident);
1677} 1678}
1678 1679
1679static void encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs4_setclientid_res *arg, struct compound_hdr *hdr) 1680static void encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs4_setclientid_res *arg, struct compound_hdr *hdr)
@@ -1747,7 +1748,8 @@ static void encode_exchange_id(struct xdr_stream *xdr,
1747 encode_op_hdr(xdr, OP_EXCHANGE_ID, decode_exchange_id_maxsz, hdr); 1748 encode_op_hdr(xdr, OP_EXCHANGE_ID, decode_exchange_id_maxsz, hdr);
1748 encode_nfs4_verifier(xdr, args->verifier); 1749 encode_nfs4_verifier(xdr, args->verifier);
1749 1750
1750 encode_string(xdr, args->id_len, args->id); 1751 encode_string(xdr, strlen(args->client->cl_owner_id),
1752 args->client->cl_owner_id);
1751 1753
1752 encode_uint32(xdr, args->flags); 1754 encode_uint32(xdr, args->flags);
1753 encode_uint32(xdr, args->state_protect.how); 1755 encode_uint32(xdr, args->state_protect.how);