aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 8dba6bd48557..40836ee5dc3a 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -447,12 +447,14 @@ static int nfs4_stat_to_errno(int);
447 encode_sequence_maxsz + \ 447 encode_sequence_maxsz + \
448 encode_putfh_maxsz + \ 448 encode_putfh_maxsz + \
449 encode_open_maxsz + \ 449 encode_open_maxsz + \
450 encode_access_maxsz + \
450 encode_getfh_maxsz + \ 451 encode_getfh_maxsz + \
451 encode_getattr_maxsz) 452 encode_getattr_maxsz)
452#define NFS4_dec_open_sz (compound_decode_hdr_maxsz + \ 453#define NFS4_dec_open_sz (compound_decode_hdr_maxsz + \
453 decode_sequence_maxsz + \ 454 decode_sequence_maxsz + \
454 decode_putfh_maxsz + \ 455 decode_putfh_maxsz + \
455 decode_open_maxsz + \ 456 decode_open_maxsz + \
457 decode_access_maxsz + \
456 decode_getfh_maxsz + \ 458 decode_getfh_maxsz + \
457 decode_getattr_maxsz) 459 decode_getattr_maxsz)
458#define NFS4_enc_open_confirm_sz \ 460#define NFS4_enc_open_confirm_sz \
@@ -467,11 +469,13 @@ static int nfs4_stat_to_errno(int);
467 encode_sequence_maxsz + \ 469 encode_sequence_maxsz + \
468 encode_putfh_maxsz + \ 470 encode_putfh_maxsz + \
469 encode_open_maxsz + \ 471 encode_open_maxsz + \
472 encode_access_maxsz + \
470 encode_getattr_maxsz) 473 encode_getattr_maxsz)
471#define NFS4_dec_open_noattr_sz (compound_decode_hdr_maxsz + \ 474#define NFS4_dec_open_noattr_sz (compound_decode_hdr_maxsz + \
472 decode_sequence_maxsz + \ 475 decode_sequence_maxsz + \
473 decode_putfh_maxsz + \ 476 decode_putfh_maxsz + \
474 decode_open_maxsz + \ 477 decode_open_maxsz + \
478 decode_access_maxsz + \
475 decode_getattr_maxsz) 479 decode_getattr_maxsz)
476#define NFS4_enc_open_downgrade_sz \ 480#define NFS4_enc_open_downgrade_sz \
477 (compound_encode_hdr_maxsz + \ 481 (compound_encode_hdr_maxsz + \
@@ -1509,8 +1513,12 @@ static void encode_open_stateid(struct xdr_stream *xdr,
1509 nfs4_stateid stateid; 1513 nfs4_stateid stateid;
1510 1514
1511 if (ctx->state != NULL) { 1515 if (ctx->state != NULL) {
1516 const struct nfs_lockowner *lockowner = NULL;
1517
1518 if (l_ctx != NULL)
1519 lockowner = &l_ctx->lockowner;
1512 nfs4_select_rw_stateid(&stateid, ctx->state, 1520 nfs4_select_rw_stateid(&stateid, ctx->state,
1513 fmode, l_ctx->lockowner, l_ctx->pid); 1521 fmode, lockowner);
1514 if (zero_seqid) 1522 if (zero_seqid)
1515 stateid.seqid = 0; 1523 stateid.seqid = 0;
1516 encode_nfs4_stateid(xdr, &stateid); 1524 encode_nfs4_stateid(xdr, &stateid);
@@ -2216,6 +2224,8 @@ static void nfs4_xdr_enc_open(struct rpc_rqst *req, struct xdr_stream *xdr,
2216 encode_putfh(xdr, args->fh, &hdr); 2224 encode_putfh(xdr, args->fh, &hdr);
2217 encode_open(xdr, args, &hdr); 2225 encode_open(xdr, args, &hdr);
2218 encode_getfh(xdr, &hdr); 2226 encode_getfh(xdr, &hdr);
2227 if (args->access)
2228 encode_access(xdr, args->access, &hdr);
2219 encode_getfattr_open(xdr, args->bitmask, args->open_bitmap, &hdr); 2229 encode_getfattr_open(xdr, args->bitmask, args->open_bitmap, &hdr);
2220 encode_nops(&hdr); 2230 encode_nops(&hdr);
2221} 2231}
@@ -2252,7 +2262,9 @@ static void nfs4_xdr_enc_open_noattr(struct rpc_rqst *req,
2252 encode_sequence(xdr, &args->seq_args, &hdr); 2262 encode_sequence(xdr, &args->seq_args, &hdr);
2253 encode_putfh(xdr, args->fh, &hdr); 2263 encode_putfh(xdr, args->fh, &hdr);
2254 encode_open(xdr, args, &hdr); 2264 encode_open(xdr, args, &hdr);
2255 encode_getfattr(xdr, args->bitmask, &hdr); 2265 if (args->access)
2266 encode_access(xdr, args->access, &hdr);
2267 encode_getfattr_open(xdr, args->bitmask, args->open_bitmap, &hdr);
2256 encode_nops(&hdr); 2268 encode_nops(&hdr);
2257} 2269}
2258 2270
@@ -4095,7 +4107,7 @@ out_overflow:
4095 return -EIO; 4107 return -EIO;
4096} 4108}
4097 4109
4098static int decode_access(struct xdr_stream *xdr, struct nfs4_accessres *access) 4110static int decode_access(struct xdr_stream *xdr, u32 *supported, u32 *access)
4099{ 4111{
4100 __be32 *p; 4112 __be32 *p;
4101 uint32_t supp, acc; 4113 uint32_t supp, acc;
@@ -4109,8 +4121,8 @@ static int decode_access(struct xdr_stream *xdr, struct nfs4_accessres *access)
4109 goto out_overflow; 4121 goto out_overflow;
4110 supp = be32_to_cpup(p++); 4122 supp = be32_to_cpup(p++);
4111 acc = be32_to_cpup(p); 4123 acc = be32_to_cpup(p);
4112 access->supported = supp; 4124 *supported = supp;
4113 access->access = acc; 4125 *access = acc;
4114 return 0; 4126 return 0;
4115out_overflow: 4127out_overflow:
4116 print_overflow_msg(__func__, xdr); 4128 print_overflow_msg(__func__, xdr);
@@ -5642,7 +5654,8 @@ static int decode_getdeviceinfo(struct xdr_stream *xdr,
5642 * and places the remaining xdr data in xdr_buf->tail 5654 * and places the remaining xdr data in xdr_buf->tail
5643 */ 5655 */
5644 pdev->mincount = be32_to_cpup(p); 5656 pdev->mincount = be32_to_cpup(p);
5645 xdr_read_pages(xdr, pdev->mincount); /* include space for the length */ 5657 if (xdr_read_pages(xdr, pdev->mincount) != pdev->mincount)
5658 goto out_overflow;
5646 5659
5647 /* Parse notification bitmap, verifying that it is zero. */ 5660 /* Parse notification bitmap, verifying that it is zero. */
5648 p = xdr_inline_decode(xdr, 4); 5661 p = xdr_inline_decode(xdr, 4);
@@ -5887,7 +5900,7 @@ static int nfs4_xdr_dec_access(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5887 status = decode_putfh(xdr); 5900 status = decode_putfh(xdr);
5888 if (status != 0) 5901 if (status != 0)
5889 goto out; 5902 goto out;
5890 status = decode_access(xdr, res); 5903 status = decode_access(xdr, &res->supported, &res->access);
5891 if (status != 0) 5904 if (status != 0)
5892 goto out; 5905 goto out;
5893 decode_getfattr(xdr, res->fattr, res->server); 5906 decode_getfattr(xdr, res->fattr, res->server);
@@ -6228,6 +6241,8 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
6228 status = decode_getfh(xdr, &res->fh); 6241 status = decode_getfh(xdr, &res->fh);
6229 if (status) 6242 if (status)
6230 goto out; 6243 goto out;
6244 if (res->access_request)
6245 decode_access(xdr, &res->access_supported, &res->access_result);
6231 decode_getfattr(xdr, res->f_attr, res->server); 6246 decode_getfattr(xdr, res->f_attr, res->server);
6232out: 6247out:
6233 return status; 6248 return status;
@@ -6276,6 +6291,8 @@ static int nfs4_xdr_dec_open_noattr(struct rpc_rqst *rqstp,
6276 status = decode_open(xdr, res); 6291 status = decode_open(xdr, res);
6277 if (status) 6292 if (status)
6278 goto out; 6293 goto out;
6294 if (res->access_request)
6295 decode_access(xdr, &res->access_supported, &res->access_result);
6279 decode_getfattr(xdr, res->f_attr, res->server); 6296 decode_getfattr(xdr, res->f_attr, res->server);
6280out: 6297out:
6281 return status; 6298 return status;