diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2010-10-20 15:44:31 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-10-23 15:27:34 -0400 |
commit | afa8ccc978c24d8ab22e3b3b8cbd1054c84c070b (patch) | |
tree | 77a05498dd1decb19f296f0e9f60da0916a40bbd /fs/nfs/nfs2xdr.c | |
parent | babddc72a9468884ce1a23db3c3d54b0afa299f0 (diff) |
NFS: remove page size checking code
Remove the page size checking code for a readdir decode. This is now done
by decode_dirent with xdr_streams.
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs2xdr.c')
-rw-r--r-- | fs/nfs/nfs2xdr.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index 0210c752e743..82f026422424 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c | |||
@@ -423,9 +423,7 @@ nfs_xdr_readdirres(struct rpc_rqst *req, __be32 *p, void *dummy) | |||
423 | struct page **page; | 423 | struct page **page; |
424 | size_t hdrlen; | 424 | size_t hdrlen; |
425 | unsigned int pglen, recvd; | 425 | unsigned int pglen, recvd; |
426 | u32 len; | ||
427 | int status, nr = 0; | 426 | int status, nr = 0; |
428 | __be32 *end, *entry, *kaddr; | ||
429 | 427 | ||
430 | if ((status = ntohl(*p++))) | 428 | if ((status = ntohl(*p++))) |
431 | return nfs_stat_to_errno(status); | 429 | return nfs_stat_to_errno(status); |
@@ -445,59 +443,7 @@ nfs_xdr_readdirres(struct rpc_rqst *req, __be32 *p, void *dummy) | |||
445 | if (pglen > recvd) | 443 | if (pglen > recvd) |
446 | pglen = recvd; | 444 | pglen = recvd; |
447 | page = rcvbuf->pages; | 445 | page = rcvbuf->pages; |
448 | kaddr = p = kmap_atomic(*page, KM_USER0); | ||
449 | end = (__be32 *)((char *)p + pglen); | ||
450 | entry = p; | ||
451 | |||
452 | /* Make sure the packet actually has a value_follows and EOF entry */ | ||
453 | if ((entry + 1) > end) | ||
454 | goto short_pkt; | ||
455 | |||
456 | for (; *p++; nr++) { | ||
457 | if (p + 2 > end) | ||
458 | goto short_pkt; | ||
459 | p++; /* fileid */ | ||
460 | len = ntohl(*p++); | ||
461 | p += XDR_QUADLEN(len) + 1; /* name plus cookie */ | ||
462 | if (len > NFS2_MAXNAMLEN) { | ||
463 | dprintk("NFS: giant filename in readdir (len 0x%x)!\n", | ||
464 | len); | ||
465 | goto err_unmap; | ||
466 | } | ||
467 | if (p + 2 > end) | ||
468 | goto short_pkt; | ||
469 | entry = p; | ||
470 | } | ||
471 | |||
472 | /* | ||
473 | * Apparently some server sends responses that are a valid size, but | ||
474 | * contain no entries, and have value_follows==0 and EOF==0. For | ||
475 | * those, just set the EOF marker. | ||
476 | */ | ||
477 | if (!nr && entry[1] == 0) { | ||
478 | dprintk("NFS: readdir reply truncated!\n"); | ||
479 | entry[1] = 1; | ||
480 | } | ||
481 | out: | ||
482 | kunmap_atomic(kaddr, KM_USER0); | ||
483 | return nr; | 446 | return nr; |
484 | short_pkt: | ||
485 | /* | ||
486 | * When we get a short packet there are 2 possibilities. We can | ||
487 | * return an error, or fix up the response to look like a valid | ||
488 | * response and return what we have so far. If there are no | ||
489 | * entries and the packet was short, then return -EIO. If there | ||
490 | * are valid entries in the response, return them and pretend that | ||
491 | * the call was successful, but incomplete. The caller can retry the | ||
492 | * readdir starting at the last cookie. | ||
493 | */ | ||
494 | entry[0] = entry[1] = 0; | ||
495 | if (!nr) | ||
496 | nr = -errno_NFSERR_IO; | ||
497 | goto out; | ||
498 | err_unmap: | ||
499 | nr = -errno_NFSERR_IO; | ||
500 | goto out; | ||
501 | } | 447 | } |
502 | 448 | ||
503 | static void print_overflow_msg(const char *func, const struct xdr_stream *xdr) | 449 | static void print_overflow_msg(const char *func, const struct xdr_stream *xdr) |