diff options
Diffstat (limited to 'fs/nfs/nfs3xdr.c')
-rw-r--r-- | fs/nfs/nfs3xdr.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index d9e08f0cf2a0..616d3267b7e7 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c | |||
@@ -346,6 +346,7 @@ nfs3_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) | |||
346 | replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS3_readres_sz) << 2; | 346 | replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS3_readres_sz) << 2; |
347 | xdr_inline_pages(&req->rq_rcv_buf, replen, | 347 | xdr_inline_pages(&req->rq_rcv_buf, replen, |
348 | args->pages, args->pgbase, count); | 348 | args->pages, args->pgbase, count); |
349 | req->rq_rcv_buf.flags |= XDRBUF_READ; | ||
349 | return 0; | 350 | return 0; |
350 | } | 351 | } |
351 | 352 | ||
@@ -367,6 +368,7 @@ nfs3_xdr_writeargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args) | |||
367 | 368 | ||
368 | /* Copy the page array */ | 369 | /* Copy the page array */ |
369 | xdr_encode_pages(sndbuf, args->pages, args->pgbase, count); | 370 | xdr_encode_pages(sndbuf, args->pages, args->pgbase, count); |
371 | sndbuf->flags |= XDRBUF_WRITE; | ||
370 | return 0; | 372 | return 0; |
371 | } | 373 | } |
372 | 374 | ||
@@ -524,7 +526,7 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res | |||
524 | 526 | ||
525 | hdrlen = (u8 *) p - (u8 *) iov->iov_base; | 527 | hdrlen = (u8 *) p - (u8 *) iov->iov_base; |
526 | if (iov->iov_len < hdrlen) { | 528 | if (iov->iov_len < hdrlen) { |
527 | printk(KERN_WARNING "NFS: READDIR reply header overflowed:" | 529 | dprintk("NFS: READDIR reply header overflowed:" |
528 | "length %d > %Zu\n", hdrlen, iov->iov_len); | 530 | "length %d > %Zu\n", hdrlen, iov->iov_len); |
529 | return -errno_NFSERR_IO; | 531 | return -errno_NFSERR_IO; |
530 | } else if (iov->iov_len != hdrlen) { | 532 | } else if (iov->iov_len != hdrlen) { |
@@ -547,7 +549,7 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res | |||
547 | len = ntohl(*p++); /* string length */ | 549 | len = ntohl(*p++); /* string length */ |
548 | p += XDR_QUADLEN(len) + 2; /* name + cookie */ | 550 | p += XDR_QUADLEN(len) + 2; /* name + cookie */ |
549 | if (len > NFS3_MAXNAMLEN) { | 551 | if (len > NFS3_MAXNAMLEN) { |
550 | printk(KERN_WARNING "NFS: giant filename in readdir (len %x)!\n", | 552 | dprintk("NFS: giant filename in readdir (len %x)!\n", |
551 | len); | 553 | len); |
552 | goto err_unmap; | 554 | goto err_unmap; |
553 | } | 555 | } |
@@ -567,7 +569,7 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res | |||
567 | goto short_pkt; | 569 | goto short_pkt; |
568 | len = ntohl(*p++); | 570 | len = ntohl(*p++); |
569 | if (len > NFS3_FHSIZE) { | 571 | if (len > NFS3_FHSIZE) { |
570 | printk(KERN_WARNING "NFS: giant filehandle in " | 572 | dprintk("NFS: giant filehandle in " |
571 | "readdir (len %x)!\n", len); | 573 | "readdir (len %x)!\n", len); |
572 | goto err_unmap; | 574 | goto err_unmap; |
573 | } | 575 | } |
@@ -588,7 +590,7 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res | |||
588 | entry[0] = entry[1] = 0; | 590 | entry[0] = entry[1] = 0; |
589 | /* truncate listing ? */ | 591 | /* truncate listing ? */ |
590 | if (!nr) { | 592 | if (!nr) { |
591 | printk(KERN_NOTICE "NFS: readdir reply truncated!\n"); | 593 | dprintk("NFS: readdir reply truncated!\n"); |
592 | entry[1] = 1; | 594 | entry[1] = 1; |
593 | } | 595 | } |
594 | goto out; | 596 | goto out; |
@@ -826,22 +828,23 @@ nfs3_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr) | |||
826 | /* Convert length of symlink */ | 828 | /* Convert length of symlink */ |
827 | len = ntohl(*p++); | 829 | len = ntohl(*p++); |
828 | if (len >= rcvbuf->page_len || len <= 0) { | 830 | if (len >= rcvbuf->page_len || len <= 0) { |
829 | dprintk(KERN_WARNING "nfs: server returned giant symlink!\n"); | 831 | dprintk("nfs: server returned giant symlink!\n"); |
830 | return -ENAMETOOLONG; | 832 | return -ENAMETOOLONG; |
831 | } | 833 | } |
832 | 834 | ||
833 | hdrlen = (u8 *) p - (u8 *) iov->iov_base; | 835 | hdrlen = (u8 *) p - (u8 *) iov->iov_base; |
834 | if (iov->iov_len < hdrlen) { | 836 | if (iov->iov_len < hdrlen) { |
835 | printk(KERN_WARNING "NFS: READLINK reply header overflowed:" | 837 | dprintk("NFS: READLINK reply header overflowed:" |
836 | "length %d > %Zu\n", hdrlen, iov->iov_len); | 838 | "length %d > %Zu\n", hdrlen, iov->iov_len); |
837 | return -errno_NFSERR_IO; | 839 | return -errno_NFSERR_IO; |
838 | } else if (iov->iov_len != hdrlen) { | 840 | } else if (iov->iov_len != hdrlen) { |
839 | dprintk("NFS: READLINK header is short. iovec will be shifted.\n"); | 841 | dprintk("NFS: READLINK header is short. " |
842 | "iovec will be shifted.\n"); | ||
840 | xdr_shift_buf(rcvbuf, iov->iov_len - hdrlen); | 843 | xdr_shift_buf(rcvbuf, iov->iov_len - hdrlen); |
841 | } | 844 | } |
842 | recvd = req->rq_rcv_buf.len - hdrlen; | 845 | recvd = req->rq_rcv_buf.len - hdrlen; |
843 | if (recvd < len) { | 846 | if (recvd < len) { |
844 | printk(KERN_WARNING "NFS: server cheating in readlink reply: " | 847 | dprintk("NFS: server cheating in readlink reply: " |
845 | "count %u > recvd %u\n", len, recvd); | 848 | "count %u > recvd %u\n", len, recvd); |
846 | return -EIO; | 849 | return -EIO; |
847 | } | 850 | } |
@@ -876,13 +879,13 @@ nfs3_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res) | |||
876 | ocount = ntohl(*p++); | 879 | ocount = ntohl(*p++); |
877 | 880 | ||
878 | if (ocount != count) { | 881 | if (ocount != count) { |
879 | printk(KERN_WARNING "NFS: READ count doesn't match RPC opaque count.\n"); | 882 | dprintk("NFS: READ count doesn't match RPC opaque count.\n"); |
880 | return -errno_NFSERR_IO; | 883 | return -errno_NFSERR_IO; |
881 | } | 884 | } |
882 | 885 | ||
883 | hdrlen = (u8 *) p - (u8 *) iov->iov_base; | 886 | hdrlen = (u8 *) p - (u8 *) iov->iov_base; |
884 | if (iov->iov_len < hdrlen) { | 887 | if (iov->iov_len < hdrlen) { |
885 | printk(KERN_WARNING "NFS: READ reply header overflowed:" | 888 | dprintk("NFS: READ reply header overflowed:" |
886 | "length %d > %Zu\n", hdrlen, iov->iov_len); | 889 | "length %d > %Zu\n", hdrlen, iov->iov_len); |
887 | return -errno_NFSERR_IO; | 890 | return -errno_NFSERR_IO; |
888 | } else if (iov->iov_len != hdrlen) { | 891 | } else if (iov->iov_len != hdrlen) { |
@@ -892,7 +895,7 @@ nfs3_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res) | |||
892 | 895 | ||
893 | recvd = req->rq_rcv_buf.len - hdrlen; | 896 | recvd = req->rq_rcv_buf.len - hdrlen; |
894 | if (count > recvd) { | 897 | if (count > recvd) { |
895 | printk(KERN_WARNING "NFS: server cheating in read reply: " | 898 | dprintk("NFS: server cheating in read reply: " |
896 | "count %d > recvd %d\n", count, recvd); | 899 | "count %d > recvd %d\n", count, recvd); |
897 | count = recvd; | 900 | count = recvd; |
898 | res->eof = 0; | 901 | res->eof = 0; |