diff options
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index b1eed4dd2eab..15f7b73e0c0f 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -1514,6 +1514,23 @@ static __be32 nfsd4_decode_reclaim_complete(struct nfsd4_compoundargs *argp, str | |||
1514 | } | 1514 | } |
1515 | 1515 | ||
1516 | static __be32 | 1516 | static __be32 |
1517 | nfsd4_decode_fallocate(struct nfsd4_compoundargs *argp, | ||
1518 | struct nfsd4_fallocate *fallocate) | ||
1519 | { | ||
1520 | DECODE_HEAD; | ||
1521 | |||
1522 | status = nfsd4_decode_stateid(argp, &fallocate->falloc_stateid); | ||
1523 | if (status) | ||
1524 | return status; | ||
1525 | |||
1526 | READ_BUF(16); | ||
1527 | p = xdr_decode_hyper(p, &fallocate->falloc_offset); | ||
1528 | xdr_decode_hyper(p, &fallocate->falloc_length); | ||
1529 | |||
1530 | DECODE_TAIL; | ||
1531 | } | ||
1532 | |||
1533 | static __be32 | ||
1517 | nfsd4_decode_seek(struct nfsd4_compoundargs *argp, struct nfsd4_seek *seek) | 1534 | nfsd4_decode_seek(struct nfsd4_compoundargs *argp, struct nfsd4_seek *seek) |
1518 | { | 1535 | { |
1519 | DECODE_HEAD; | 1536 | DECODE_HEAD; |
@@ -1604,10 +1621,10 @@ static nfsd4_dec nfsd4_dec_ops[] = { | |||
1604 | [OP_RECLAIM_COMPLETE] = (nfsd4_dec)nfsd4_decode_reclaim_complete, | 1621 | [OP_RECLAIM_COMPLETE] = (nfsd4_dec)nfsd4_decode_reclaim_complete, |
1605 | 1622 | ||
1606 | /* new operations for NFSv4.2 */ | 1623 | /* new operations for NFSv4.2 */ |
1607 | [OP_ALLOCATE] = (nfsd4_dec)nfsd4_decode_notsupp, | 1624 | [OP_ALLOCATE] = (nfsd4_dec)nfsd4_decode_fallocate, |
1608 | [OP_COPY] = (nfsd4_dec)nfsd4_decode_notsupp, | 1625 | [OP_COPY] = (nfsd4_dec)nfsd4_decode_notsupp, |
1609 | [OP_COPY_NOTIFY] = (nfsd4_dec)nfsd4_decode_notsupp, | 1626 | [OP_COPY_NOTIFY] = (nfsd4_dec)nfsd4_decode_notsupp, |
1610 | [OP_DEALLOCATE] = (nfsd4_dec)nfsd4_decode_notsupp, | 1627 | [OP_DEALLOCATE] = (nfsd4_dec)nfsd4_decode_fallocate, |
1611 | [OP_IO_ADVISE] = (nfsd4_dec)nfsd4_decode_notsupp, | 1628 | [OP_IO_ADVISE] = (nfsd4_dec)nfsd4_decode_notsupp, |
1612 | [OP_LAYOUTERROR] = (nfsd4_dec)nfsd4_decode_notsupp, | 1629 | [OP_LAYOUTERROR] = (nfsd4_dec)nfsd4_decode_notsupp, |
1613 | [OP_LAYOUTSTATS] = (nfsd4_dec)nfsd4_decode_notsupp, | 1630 | [OP_LAYOUTSTATS] = (nfsd4_dec)nfsd4_decode_notsupp, |
@@ -1714,7 +1731,7 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) | |||
1714 | argp->rqstp->rq_cachetype = cachethis ? RC_REPLBUFF : RC_NOCACHE; | 1731 | argp->rqstp->rq_cachetype = cachethis ? RC_REPLBUFF : RC_NOCACHE; |
1715 | 1732 | ||
1716 | if (readcount > 1 || max_reply > PAGE_SIZE - auth_slack) | 1733 | if (readcount > 1 || max_reply > PAGE_SIZE - auth_slack) |
1717 | argp->rqstp->rq_splice_ok = false; | 1734 | clear_bit(RQ_SPLICE_OK, &argp->rqstp->rq_flags); |
1718 | 1735 | ||
1719 | DECODE_TAIL; | 1736 | DECODE_TAIL; |
1720 | } | 1737 | } |
@@ -1795,9 +1812,12 @@ static __be32 nfsd4_encode_components_esc(struct xdr_stream *xdr, char sep, | |||
1795 | } | 1812 | } |
1796 | else | 1813 | else |
1797 | end++; | 1814 | end++; |
1815 | if (found_esc) | ||
1816 | end = next; | ||
1817 | |||
1798 | str = end; | 1818 | str = end; |
1799 | } | 1819 | } |
1800 | pathlen = htonl(xdr->buf->len - pathlen_offset); | 1820 | pathlen = htonl(count); |
1801 | write_bytes_to_xdr_buf(xdr->buf, pathlen_offset, &pathlen, 4); | 1821 | write_bytes_to_xdr_buf(xdr->buf, pathlen_offset, &pathlen, 4); |
1802 | return 0; | 1822 | return 0; |
1803 | } | 1823 | } |
@@ -3236,10 +3256,10 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr, | |||
3236 | 3256 | ||
3237 | p = xdr_reserve_space(xdr, 8); /* eof flag and byte count */ | 3257 | p = xdr_reserve_space(xdr, 8); /* eof flag and byte count */ |
3238 | if (!p) { | 3258 | if (!p) { |
3239 | WARN_ON_ONCE(resp->rqstp->rq_splice_ok); | 3259 | WARN_ON_ONCE(test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags)); |
3240 | return nfserr_resource; | 3260 | return nfserr_resource; |
3241 | } | 3261 | } |
3242 | if (resp->xdr.buf->page_len && resp->rqstp->rq_splice_ok) { | 3262 | if (resp->xdr.buf->page_len && test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags)) { |
3243 | WARN_ON_ONCE(1); | 3263 | WARN_ON_ONCE(1); |
3244 | return nfserr_resource; | 3264 | return nfserr_resource; |
3245 | } | 3265 | } |
@@ -3256,7 +3276,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr, | |||
3256 | goto err_truncate; | 3276 | goto err_truncate; |
3257 | } | 3277 | } |
3258 | 3278 | ||
3259 | if (file->f_op->splice_read && resp->rqstp->rq_splice_ok) | 3279 | if (file->f_op->splice_read && test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags)) |
3260 | err = nfsd4_encode_splice_read(resp, read, file, maxcount); | 3280 | err = nfsd4_encode_splice_read(resp, read, file, maxcount); |
3261 | else | 3281 | else |
3262 | err = nfsd4_encode_readv(resp, read, file, maxcount); | 3282 | err = nfsd4_encode_readv(resp, read, file, maxcount); |