diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-11-20 12:43:45 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-11-22 13:24:44 -0500 |
commit | 5c346854d8ce6ca91931f8fc9177934257a667d0 (patch) | |
tree | de10054f20a2bc3a2fc58ca394854d40aebc8654 /fs/nfs | |
parent | 463a376eae1c92a66c912af539bfd4bbefa37673 (diff) |
NFS: Assume eof if the server returns no readdir records
Some servers are known to be buggy w.r.t. this. Deal with them...
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/dir.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 662df2a5fad5..2789cb3fc425 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -466,8 +466,9 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en | |||
466 | struct xdr_stream stream; | 466 | struct xdr_stream stream; |
467 | struct xdr_buf buf; | 467 | struct xdr_buf buf; |
468 | __be32 *ptr = xdr_page; | 468 | __be32 *ptr = xdr_page; |
469 | int status; | ||
470 | struct nfs_cache_array *array; | 469 | struct nfs_cache_array *array; |
470 | unsigned int count = 0; | ||
471 | int status; | ||
471 | 472 | ||
472 | buf.head->iov_base = xdr_page; | 473 | buf.head->iov_base = xdr_page; |
473 | buf.head->iov_len = buflen; | 474 | buf.head->iov_len = buflen; |
@@ -488,6 +489,8 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en | |||
488 | break; | 489 | break; |
489 | } | 490 | } |
490 | 491 | ||
492 | count++; | ||
493 | |||
491 | if (desc->plus == 1) | 494 | if (desc->plus == 1) |
492 | nfs_prime_dcache(desc->file->f_path.dentry, entry); | 495 | nfs_prime_dcache(desc->file->f_path.dentry, entry); |
493 | 496 | ||
@@ -496,13 +499,14 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en | |||
496 | break; | 499 | break; |
497 | } while (!entry->eof); | 500 | } while (!entry->eof); |
498 | 501 | ||
499 | if (status == -EBADCOOKIE && entry->eof) { | 502 | if (count == 0 || (status == -EBADCOOKIE && entry->eof == 1)) { |
500 | array = nfs_readdir_get_array(page); | 503 | array = nfs_readdir_get_array(page); |
501 | if (!IS_ERR(array)) { | 504 | if (!IS_ERR(array)) { |
502 | array->eof_index = array->size; | 505 | array->eof_index = array->size; |
503 | status = 0; | 506 | status = 0; |
504 | nfs_readdir_release_array(page); | 507 | nfs_readdir_release_array(page); |
505 | } | 508 | } else |
509 | status = PTR_ERR(array); | ||
506 | } | 510 | } |
507 | return status; | 511 | return status; |
508 | } | 512 | } |