summaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
authorKinglong Mee <kinglongmee@gmail.com>2015-08-26 09:12:58 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-08-27 19:45:27 -0400
commit8c61282ff61c28d5a12bb53f0eaa221d30fd3ae1 (patch)
tree30b45d2b58931e12d7d28c48548e41aa4330fc76 /fs/nfs/nfs4xdr.c
parent5153aacfb8e2744af68e7b84ccd3f02aeefe4f48 (diff)
NFS: Get suppattr_exclcreat when getting server capabilities
Create file with attributs as NFS4_CREATE_EXCLUSIVE4_1 mode depends on suppattr_exclcreat attribut. v3, same as v2. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index c42459e45f62..ad8dde12f23b 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2582,6 +2582,7 @@ static void nfs4_xdr_enc_server_caps(struct rpc_rqst *req,
2582 struct xdr_stream *xdr, 2582 struct xdr_stream *xdr,
2583 struct nfs4_server_caps_arg *args) 2583 struct nfs4_server_caps_arg *args)
2584{ 2584{
2585 const u32 *bitmask = args->bitmask;
2585 struct compound_hdr hdr = { 2586 struct compound_hdr hdr = {
2586 .minorversion = nfs4_xdr_minorversion(&args->seq_args), 2587 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2587 }; 2588 };
@@ -2589,11 +2590,7 @@ static void nfs4_xdr_enc_server_caps(struct rpc_rqst *req,
2589 encode_compound_hdr(xdr, req, &hdr); 2590 encode_compound_hdr(xdr, req, &hdr);
2590 encode_sequence(xdr, &args->seq_args, &hdr); 2591 encode_sequence(xdr, &args->seq_args, &hdr);
2591 encode_putfh(xdr, args->fhandle, &hdr); 2592 encode_putfh(xdr, args->fhandle, &hdr);
2592 encode_getattr_one(xdr, FATTR4_WORD0_SUPPORTED_ATTRS| 2593 encode_getattr_three(xdr, bitmask[0], bitmask[1], bitmask[2], &hdr);
2593 FATTR4_WORD0_FH_EXPIRE_TYPE|
2594 FATTR4_WORD0_LINK_SUPPORT|
2595 FATTR4_WORD0_SYMLINK_SUPPORT|
2596 FATTR4_WORD0_ACLSUPPORT, &hdr);
2597 encode_nops(&hdr); 2594 encode_nops(&hdr);
2598} 2595}
2599 2596
@@ -3370,6 +3367,22 @@ out_overflow:
3370 return -EIO; 3367 return -EIO;
3371} 3368}
3372 3369
3370static int decode_attr_exclcreat_supported(struct xdr_stream *xdr,
3371 uint32_t *bitmap, uint32_t *bitmask)
3372{
3373 if (likely(bitmap[2] & FATTR4_WORD2_SUPPATTR_EXCLCREAT)) {
3374 int ret;
3375 ret = decode_attr_bitmap(xdr, bitmask);
3376 if (unlikely(ret < 0))
3377 return ret;
3378 bitmap[2] &= ~FATTR4_WORD2_SUPPATTR_EXCLCREAT;
3379 } else
3380 bitmask[0] = bitmask[1] = bitmask[2] = 0;
3381 dprintk("%s: bitmask=%08x:%08x:%08x\n", __func__,
3382 bitmask[0], bitmask[1], bitmask[2]);
3383 return 0;
3384}
3385
3373static int decode_attr_filehandle(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fh *fh) 3386static int decode_attr_filehandle(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fh *fh)
3374{ 3387{
3375 __be32 *p; 3388 __be32 *p;
@@ -4323,6 +4336,9 @@ static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_re
4323 goto xdr_error; 4336 goto xdr_error;
4324 if ((status = decode_attr_aclsupport(xdr, bitmap, &res->acl_bitmask)) != 0) 4337 if ((status = decode_attr_aclsupport(xdr, bitmap, &res->acl_bitmask)) != 0)
4325 goto xdr_error; 4338 goto xdr_error;
4339 if ((status = decode_attr_exclcreat_supported(xdr, bitmap,
4340 res->exclcreat_bitmask)) != 0)
4341 goto xdr_error;
4326 status = verify_attr_len(xdr, savep, attrlen); 4342 status = verify_attr_len(xdr, savep, attrlen);
4327xdr_error: 4343xdr_error:
4328 dprintk("%s: xdr returned %d!\n", __func__, -status); 4344 dprintk("%s: xdr returned %d!\n", __func__, -status);